From:
[email protected]
This is a multi-part MIME message sent by reportbug.
Package: netpbm
Version: 2:10.0-5
Followup-For: Bug #238372
Hey Andi -
I ran into this bug using -alpha, and a different one with -transparent
picking the wrong color. The alpha one seems to be an off-by-one thinko,
and the -transparent one is an obvious copy & paste error. Patch
attached (if I can figure out how to attach via reportbug :-)
Ross J. Reedstrom
--
Ross Reedstrom, Ph.D.
[email protected] Research Scientist phone: 713-348-6166
The Connexions Project
http://cnx.rice.edu fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE
--- netpbm-free-10.0/pnm/pnmtopng.c 2004-01-05 04:39:56.000000000 -0600
+++ netpbm-free-10.0-fixed/pnm/pnmtopng.c 2004-08-19 22:59:33.000000000 -0500
@@ -222,7 +222,7 @@
unsigned int match =
SQR(PPM_GETR(thisColor) - PPM_GETR(targetColor)) +
SQR(PPM_GETG(thisColor) - PPM_GETG(targetColor)) +
- SQR(PPM_GETB(thisColor) - PPM_GETG(targetColor));
+ SQR(PPM_GETB(thisColor) - PPM_GETB(targetColor));
if (match < bestMatch) {
bestMatch = match;
@@ -797,7 +797,7 @@
*tooBigP = FALSE;
bot_idx = 0;
- top_idx = alphas_first_index[colors] + alphas_of_color_cnt[colors] - 1;
+ top_idx = alphas_first_index[colors-1] + alphas_of_color_cnt[colors-1] - 1;
/* remap palette indices so opaque entries are last */
for (colorIndex = 0; colorIndex < colors; ++colorIndex) {
@@ -889,6 +889,8 @@
*transSizeP = 1;
if (verbose) {
pixel const p = palette_pnm