Re: [LyX/master] Use inkscape as fallback png->eps converter
Koji Yokota <[email protected]> Tue, 2 Jun 2026 09:46:52 +0900
| Newsgroups | gmane.editors.lyx.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Juergen, > + from PIL import Image On macOS, python module “pillow” is not installed by default, so it raises the following error at configuration time: > Traceback (most recent call last): > File "/Users/koji/workspace/repo/lyx-collab/collab/lib/configure.py", line 2184, in <module> > checkConverterEntries() > ~~~~~~~~~~~~~~~~~~~~~^^ > File "/Users/koji/workspace/repo/lyx-collab/collab/lib/configure.py", line 1259, in checkConverterEntries > from PIL import Image > ModuleNotFoundError: No module named 'PIL' Koji > 2026/05/15 21:39、Juergen Spitzmueller <[email protected]>のメール: > > commit 5aefad462b850708012eea42cff0145452a1cb6b > Author: Juergen Spitzmueller <[email protected]> > Date: Fri May 15 14:38:30 2026 +0200 > > Use inkscape as fallback png->eps converter > > if ImageMagick is not available or IM policy does not allow for this > conversion > --- > lib/configure.py | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/lib/configure.py b/lib/configure.py > index 8561a51b7f..bad14f34c2 100644 > --- a/lib/configure.py > +++ b/lib/configure.py > @@ -1247,12 +1247,39 @@ def checkConverterEntries(): > removeFiles(['mock.eps']) > #needs empty record otherwise default converter will be issued > addToRC(r'''\converter eps png "" "" > -\converter png eps "" "" > \converter jpg tiff "convert $$i $$o" "" > \converter png tiff "convert $$i $$o" ""''') > logger.info('ImageMagick seems to ban conversions from EPS. Disabling direct EPS->PNG.') > pdftopng.append('pdftoppm -r 72 -png -singlefile $$i > $$o') > # > + # Same for png to eps > + _, cmd = checkProg('a PNG -> EPS converter', ['magick', 'convert']) > + have_png2eps = False > + if cmd: > + from PIL import Image > + img = Image.new('RGB', (5, 5)) > + img.save("mock.png", "PNG") > + try: > + subprocess.check_call([cmd, "mock.png", "mock.eps"]) > + removeFiles(['mock.eps', 'mock.png']) > + rc_entry = r'\converter png eps "%s $$i[0] $$o" ""' > + addToRC(rc_entry % cmd) > + have_png2eps = True > + except: > + removeFiles(['mock.png']) > + #needs empty record otherwise default converter will be issued > + addToRC(r'''\converter png eps "" ""''') > + logger.info('ImageMagick seems to ban conversions to EPS. Disabling direct PNG->EPS.') > + > + if not have_png2eps: > + #try inkscape instead. > + if inkscape_stable: > + checkProg('an alternative PNG -> EPS converter', [inkscape_cl + ' $$i --export-area-drawing --export-filename=$$o'], > + rc_entry = [ r'\converter png eps "%%" ""']) > + else: > + checkProg('an alternative PNG -> EPS converter', [inkscape_cl + ' --file=$$i --export-area-drawing --without-gui --export-eps=$$o'], > + rc_entry = [ r'\converter png eps "%%" ""']) > + # > # PDF -> PNG: sips (mac), IM convert (windows, linux), pdftoppm (linux with IM ban) > # sips:Define a converter from pdf6 to png for Macs where pdftops is missing. > # The converter utility sips allows to force the dimensions of the resulting > -- > lyx-cvs mailing list > [email protected] > https://lists.lyx.org/mailman/listinfo/lyx-cvs -- lyx-devel mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-devel