Warning: dvipng failed to generate images from lyxpreviewSZhsFp.dvi... fallback to legacy method

Enrico Forestieri forenr at lyx.org
Tue May 20 17:05:34 UTC 2025


On Mon, May 19, 2025 at 11:39:32PM +0200, Enrico Forestieri wrote:
>On Mon, May 19, 2025 at 02:44:06PM +0200, Jean-Marc Lasgouttes wrote:
>>Dear all,
>>
>>With UserGuide, I get a lot of output concerning previews:
>>
>>Warning: dvipng failed to generate images from 
>>lyxpreviewSZhsFp.dvi... fallback to legacy method
>>Warning: epstopdf failed on page 1, file lyxpreviewSZhsFp.001
>>Warning: epstopdf failed on page 2, file lyxpreviewSZhsFp.002
>>[...]
>>Warning: epstopdf failed on page 108, file lyxpreviewSZhsFp.108
>>Warning: epstopdf failed on page 109, file lyxpreviewSZhsFp.109
>>Warning: Now trying to obtain failed previews through pdflatex
>>
>>How do I debug this? The only thin I manage to do it to run dvipng 
>>on lyxpreviewSZhsFp.dvi, and see that it ends with:
>> dvipng: Fatal error, out of color stack space
>>
>>Any idea? I understand I may be missing some program, but which one?
>
>Is it any better after 1888d50e?

I had a closer look at this issue. The only problem occurring on Windows 
has been solved by 1888d50e. However, I tried on linux and I get the 
same results as yours. The only difference is the dvipng version, which 
is 1.16 in Windows and 1.15 in Debian.

It turns out that version 1.15 errors out when some postscript specials 
are present and lyxpreview2bitmap.py aborts everything and tries the 
legacy route. Instead, version 1.16 does not error out and our script is 
prepared to deal with the failing previews by only trying on them the 
legacy route.

So, this is a dvipng issue, confirmed by the fact that I tried version 
1.18 from Debian/testing and it works fine.

I don't know what to do. On the one hand the attached patch solves the 
issue for me with version 1.15, but I don't have any info on the return 
codes from dvipng and it very possible that that return code (136) is 
not specific to postscript specials issues. On the other end, the 
problem will disappear by upgrading dvipng.

-- 
Enrico
-------------- next part --------------
diff --git a/lib/scripts/lyxpreview2bitmap.py b/lib/scripts/lyxpreview2bitmap.py
index 56314356d1..dade8745bb 100755
--- a/lib/scripts/lyxpreview2bitmap.py
+++ b/lib/scripts/lyxpreview2bitmap.py
@@ -513,7 +513,7 @@ def main(argv):
         % (dvipng, resolution, fg_color_dvipng, bg_color_dvipng, pages_parameter, dvi_file)
     dvipng_status, dvipng_stdout = run_command(dvipng_call)
 
-    if dvipng_status:
+    if dvipng_status and int(dvipng_status) != 136:
         warning("%s failed to generate images from %s... fallback to legacy method" \
               % (os.path.basename(dvipng), dvi_file))
         progress("Using the legacy conversion method (dvipng failed)")


More information about the lyx-devel mailing list