[texhax] How do I generate a .jpg/.gif/.png from TeX ?

John Palmer johnp at palmyra.uklinux.net
Mon Dec 24 12:38:10 CET 2007


On Sunday 23 December 2007 22:25:18 Aaron Gray wrote:
> generate a JPEG, GIF, or PNG file

This is how I do it for my spotmaps of archaeological finds: details recently 
revised.  Adjust the constants to your preference.  This currently runs on 
Ubuntu Feisty.  I don't pipe, so that I can inspect the intermediate stages.

  latex $NAME
  dvips -f <$NAME.dvi >$NAME.ps
# convert this to pgm (I am working in black and white)
  pstopnm -xsize 1000 -pgm $NAME.ps # 2007-12-14
# trim empty margins
  pnmcrop ${NAME}001.pgm >$NAME.pgm  # 2007-12-14
# scale : it is worth doing this anyway, as pnmscale provides anti-aliasing.
  pnmscale 0.6 $NAME.pgm >${NAME}s.pgm # 2007-12-14
# and then to png
  pnmtopng ${NAME}s.pgm >$NAME.png # 2007-12-14

Happy Christmas.
John

-- 
John Palmer
Preston near Weymouth, Dorset, England
e-mail:  johnp at bcs.org.uk (plain text preferred)
website: http://www.palmyra.uklinux.net/


More information about the texhax mailing list