[l2h] pstoimg conversion fail

Jean-Pierre Chretien Jean-Pierre.Chretien at cert.fr
Wed Nov 8 19:37:45 CET 2006

>>Date: Wed, 8 Nov 2006 16:24:29 +0100
>>From: Pavel Sanda <sanda at atrey.karlin.mff.cuni.cz>
>>To: latex2html at tug.org
>>Subject: [l2h] pstoimg conversion fail
>>having failed to find the maintainer of pstoimg,
>>which is part of the latex2html, i send it here...
>>pstoimg fails to convert certain postscript image
>>when running "pstoimg bum.ps"
>>(see attachment)
>>when i looked more deeply into the problem, it
>>seems that pstoimg wrongly create .pnm file -
>>pnm wrongly contains two images instead of one
>>(see "pamfile -allimages" for the interim pnm file )
>>and the reason is the "showpage" command during
>>the call of the ghostcript in pstoimg.
>>when i comment out that command, it creates only 
>>one image in .pnm and netpbm utilities dont complain
>>interestingly, when i try to run pstoimg bum2.ps
>>which is the same file, but in monochromatic
>>version, there is no problem.
>>one possibility howto repair it is to give 
>>correct command to ghostscript (however i'm not
>>experienced with its commands, so i'm not sure 
>>whether removing of showpage doesnt harm something 
>>second possibility is to use 'pampick 0' for picking
>>the only the first image before 'ppmquant' calling from

Which version of pstoimg are you using ?
Here with
pstoimg V2002-2-1 (Revision 1.19, Perl 5.006001)
all is OK.

Anyway, you must be sure that your graphics are in EPS (encalsulated postscript)
format. EPS has got no showpage command inside (theroetically, it cannot be printed alone),
and has got a bounding box describing the size of the graphic.
Keeping ps graphics in latex documents may work (the showpage will be ignored),
but this is not robuts and prone to errors with other software: pstoimg is one of them
from your exmaple.

You may use ps2eps (by Roland Bless) to normalize your graphics, which gives the following diffs:
-> gdiff -u bum.ps bum.eps
--- bum.ps	2006-11-08 19:26:34.720076028 +0100
+++ bum.eps	2006-11-08 19:26:50.490286847 +0100
@@ -1,11 +1,19 @@
 %!PS-Adobe-2.0 EPSF-2.0
+%%BoundingBox: 56 49 402 293
+% EPSF created by ps2eps 1.47
 %%Title: fig_end_bacteria_graph.ps
 %%Creator: gnuplot 4.0 patchlevel 0
 %%CreationDate: Sun Oct 29 18:10:43 2006
-%%DocumentFonts: (atend)
-%%BoundingBox: 50 50 410 302
-%%Orientation: Portrait
+/showpage {} def
+/setpagedevice {pop} def
+%%Page 1 1
 /gnudict 256 dict def
 gnudict begin
 /Color true def
@@ -302,7 +310,6 @@
 /MCshow { currentpoint stroke M
   exch dup MFwidth -2 div 3 -1 roll R MFshow } def
 gnudict begin
 50 50 translate
@@ -507,5 +514,10 @@
 %%DocumentFonts: Helvetica
+exch sub { end } repeat

You can see that showpage is redefined to {}.



More information about the latex2html mailing list