LyX 2.4.0 (IM policy.xml ban on eps/pdf conversions)

Pavel Sanda sanda at lyx.org
Wed Feb 2 21:45:40 UTC 2022


On Mon, Jan 24, 2022 at 11:32:42PM +0100, Pavel Sanda wrote:
> On Thu, Dec 02, 2021 at 10:24:58PM +0100, Pavel Sanda wrote:
> > - improve detection/users warning for banned eps->* conversion of imagemagick (high priority before final release, but not for next alpha/beta etc)
> 
> One option to automatically overcome the issue is to disable eps->png conversion and allow pdf->png so that lyx performs eps->pdf->png.
> On my debian adding this to preferences sort of fixes the issue:
> 
> \converter "pdf6" "png" "pdftoppm -png -singlefile $$i >  $$o" ""
> \converter "eps" "png" "" ""
> 
> Problems I see:
> - the zoom factors in lyx window are not consistent with previous IM conversion (you need to remove cache to test this)

I found out that IM uses by default DPI of 72 when calling GS so this problem is solved by using "pdftoppm -r 72 -png -singlefile $$i >  $$o"
Transparency is lost but I don't think that is a big deal.

> - not sure how is the pdftoppm conversion portable to windows/mac environment

Actually we have GS under our control for Win, not sure about Mac but mayb the IM policy is not to ban eps/pdf conversions.

> We could perhaps check policy.xml of IM and add those only in case eps/pdf is banned when doing reconfigure.

Jose, could I ask for pythonic help?
We would need a routine in configure.py which check whether to remove eps->png conversion in case IM bans those conversions.
That could be done this way by checking return status of the conversion. In bash that would be something like this:

echo '%!PS' > /tmp/.lyx_configure_test.eps
convert  /tmp/.lyx_configure_test.eps /tmp/.lyx_configure_test.png
if ! [ $? == 0 ] ; then 
  # remove eps->png conversion from configure settings, i.e. set \converter "eps" "png" "" ""
fi


Completely different way would be mimicking what IM internally does with GS when converting eps->png. I already checked little bit and unfortunately it won't be oneliner if we want to get resolution right. But probably doable with additional script of our own.
Pavel


More information about the lyx-devel mailing list