[OS X TeX] htlatex not producing png files

Jens Nöckel noeckel at uoregon.edu
Tue Sep 27 06:19:47 CEST 2005

On Sep 26, 2005, at 8:08 PM, Michael Stiber wrote:

> I've a machine with newly installed TeX et al. with i-Installer. The 
> setup works fine, _except_ that htlatex doesn't convert eps figures to 
> png. It gets the bounding boxes from the eps files (I can see the 
> width and height in the html file), but it doesn't actually run gs to 
> produce the png files. I _can_ generate the png files by running gs by 
> hand, using the bounding box information from the html. I just 
> re-installed TeX, thinking that perhaps I needed to install it after 
> ghostscript and ImageMagick, but still no dice. How can I get this to 
> work?
Hi Michael,

when you run tex4ht, do you actually in the log or the terminal output 
see that the conversion program tries to run ghostscript? Is it a 
command starting with gs -sDEVICE=pngalpha ...? Or is your script 
perhaps trying to invoke netpbm or convert but fails?

The bitmap conversion is configured in the tex4ht.env file located in 
your tex4ht directory - I use the fink version so I don't have the 
exact path info for your installation. Anyway, if you make a copy of 
that configuration file in your home directory and call it .tex4ht , 
then you can edit that file and override the default configuration 
which seems to be faulty.

A few weeks ago Martin Costabel and I made some modifications to the 
tex4ht graphics conversion in the fink package. This version uses dvips 
and imagemagick (convert) for the conversion to png and all other 
bitmap formats. If what you're looking for is the route which involves
gs -sDEVICE=pngalpha
then you don't need "convert" at all. But to know what's going on, one 
would have to loook at your tex4ht.env file. The main pitfall with 
these files is that leading spaces (indentations) at the beginning of a 
line effectively comment out that line. So one has to scroll down to 
the bitmap conversion block starting with the tag <convert> and see 
what commands are actually commented out or in. The entries that invoke 
purely gs-based conversion to png are the following (in my file):

  Gdvips -E -q -Ppdf -f %%1 -pp %%2 > zz%%4.ps
  Ggs -sDEVICE=pngalpha -sOutputFile=%%3 -r110x110 \
   -dEPSCrop -dBackgroundColor=16#ffffff -dTextAlphaBits=2 \
   -dGraphicsAlphaBits=2 -q -dbatch -dNOPAUSE zz%%4.ps -c quit
  Grm zz%%4.ps

(backslashes = line continuation)

In the fink installation, these are commented out because all 
conversions are handled by a script further down, starting with
Gdvips -E -Ppdf -mode ibmvga -D 110 -f %%1 -pp %%2  > zz%%4.ps
Gconvert  -trim +repage -density 110x110 zz%%4.ps -transparent 
'#FFFFFF' %%3
Grm zz%%4.ps

The "Gconvert" line above is something I modified because the original 
source distribution had the arguments of the convert utility in the 
wrong order. In fact, another thing you may want to try is (we did 
this) is to comment out (indent) the <convert>  and </convert> tags 

If you have imagemagick installed, then I'd suggest setting things up 
the fink way (i.e. enabling the last 4 lines I quoted), just to see if 
that works for you.



Jens Uwe Nöckel
Assistant Professor
Department of Physics
University of Oregon

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the macostex-archives mailing list