[l2h] pstoimg bug: 24-bit color depth
David Pritchard
drpritch at cs.ubc.ca
Tue Apr 8 02:43:01 CEST 2003
I've found a bug in pstoimg.
The -depth command-line parameter and DEPTH environment variable are
supposed to allow the user to choose the colour depth of the bitmap.
Valid values are 1, 8 and 24 according to the documentation, and the
default is 8.
So, I added a $ENV{DEPTH}=24 line to my .latex2html-init file. However,
pstoimg then generates the following commandline:
Running "/usr/bin/pnmcrop -verbose < /tmp/l2h9345/p9567.pnm | |
/usr/bin/pnmtopng -interlace > img21.png"
The double pipe causes a shell error, and the image doesn't get
generated. This is simply due to the way the reduce_color variable is
used - typically, $reduce_color is set to something like "ppmquant 256".
When depth is 24, however, there's no need to call ppmquant, and
$reduce_color is empty. However, the current code still executes a
$reduce_color command in the pipeline, even though $reduce_color is a
null command.
The sequence
if(!$type || $type =~ /(ppm|pgm)/i) {
if($cmd) {
$cmd .= "| $reduce_color "
} else {
$cmd = "$reduce_color < $in ";
}
}
should be changed to
if((!$type || $type =~ /(ppm|pgm)/i) && $reduce_color) {
if($cmd) {
$cmd .= "| $reduce_color "
} else {
$cmd = "$reduce_color < $in ";
}
}
That should fix the bug,
- David
--
David Pritchard http://www.david.enigmati.ca
drpritch [ at ] cs [ point ] ubc [ point ] ca
Imager Lab, Computer Science Department, University of British Columbia
More information about the latex2html
mailing list