[l2h] pstoimg on cygwin?

Igor Peshansky pechtcha at cs.nyu.edu
Fri Mar 23 22:25:36 CET 2007


On Fri, 23 Mar 2007, Alle Meije Wink wrote:

> Hi-
>
> I have installed latex2html on cygwin -after installing netpbm and perl
> (which was on there from the beginning) and following the instructions
> at [http://www.cs.utexas.edu/~suvrit/work/l2h.html]. Everything worked
> in one go, no complaints.
>
> Then I tried pstoimg on a black-and-white .eps file, got a png file
> exactly as expected.
>
> Then pstoimg on a color .eps file (made with gnuplot), and I got this error:
> > $ pstoimg IAN_PER3rawrotation.eps
> > pstoimg V2002-2-1 (Revision 1.16, Perl 5.008007)
> > pstoimg: Processing IAN_PER3rawrotation.eps
> > pstoimg: Error: "/usr/bin/ppmquant 256 < /tmp/p612.pnm | /usr/bin/pnmtopng  > IAN_PER3rawrotation.png" failed:
>
> It doesn't say why, but when I run the command between quotes I get:
> > $ /usr/bin/ppmquant 256 < /tmp/p612.pnm | /usr/bin/pnmtopng  > IAN_PER3rawrotation.png
> > pnmcolormap: making histogram...
> > pnmcolormap: Scanning image 0
> > pnmcolormap: 7 colors so far
> > pnmcolormap: Scanning image 1
> > pnmcolormap: Image 1 depth (1) is not the same as Image 0 (3)
> > pnmcolormap failed, rc=256
> > pnmtopng: Error reading magic number from Netpbm image stream.  Most often, this means your input file is empty.
>
> All I know at this point is that ppmquant, or rather, a call inside
> ppmquant to pnmcolormap, goes wrong in cygwin.
> Does anyone else know of this problem, and has anyone found a workaround
> yet?
>
> If it helps, the gnuplot file that I use has these output options:
> > set size 2.2,1.1
> > set terminal postscript eps enhanced color "Helvetica" 28
> > set output "IAN_PER3rawrotation.eps"
> > set border 15 lw 2
> > set key bottom left
> [clip]
>
> Maybe one of these options (`enhanced') screws up pstoimg?
>
> Just to make sure:
> Running the same commands in Linux results in a beautiful PNG file!
> Also, the EPS and PNM files in cygwin look completely fine. See
> http://www.wbic.cam.ac.uk/~amw71/IAN_PER3rawrotation.eps
> http://www.wbic.cam.ac.uk/~amw71/p612.pnm

Hi,

I've investigated this a bit.  If you run pstoimg with -debug, you'll see
something like

pstoimg: Running /usr/local/bin/gs  -sDEVICE=pnmraw -g792x277    -sOutputFile=/tmp/p5960.pnm
GS>-50 -50 translate
GS>(IAN_PER3rawrotation.eps) run
GS>showpage
GS>quit

It's the "showpage" that is the problem, since the eps you have already
has a "showpage".  So the second page ends up being blank (and
black-and-white, with depth 1).  Running the gs command manually without
the second "showpage" produces a beautiful png after ppmquant.

The reason it works on black-and-white images is that ppmquant does not
complain if both pages have color depth 1.  The reason it worked for you
on Linux is probably the fact that the Linux version of gs produces the
second page at the same color depth as the first one, rather than
black-and-white (possibly an optimization in Cygwin's gs).

The generation of "showpage" is guarded by the $epsf flag in pstoimg.
Editing your .eps and changing the "EPSF-2.0" to "EPS-2.0" in the first
line made pstoimg work with no problems.  It's unclear why the "showpage"
is needed for EPSF files, though, so it would probably not be a good idea
to remove it.  As-is, just consider the EPSF support in Cygwin's gs
broken.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha at cs.nyu.edu | igor at watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin


More information about the latex2html mailing list