#731757 netpbm: ppmquant -floyd 256 sometimes produces incorrect output

Package:
netpbm
Source:
netpbm-free
Description:
Graphics conversion tools between image formats
Submitter:
Matthias Lang
Date:
2013-12-09 13:45:06 UTC
Severity:
normal
#731757#5
Date:
2013-12-09 13:26:13 UTC
From:
To:
Hi,

   ppmquant -floyd 256

sometimes produces incorrect output, i.e. an image which is visually corrupt. This
is bad because 'latex2html' runs ppmquant with exactly that argument for images
it converts.

Shortest sequence I know of to trigger the bug:

   mkdir netpbm_bug
   cd netpbm_bug
   wget http://corelatus.se/~matthias/ppmquant_bug_report.pnm
   ppmquant -floyd 256 < ppmquant_bug_report.pnm > broken.pnm

On my PC, this creates a bad image approximately 30% of the time I run 'ppmquant'.
For reference, I've also uploaded a bad image:

http://corelatus.se/~matthias/ppmquant_broken.pnm

Replacing the '256' in the argument to ppmquant with 16 seems to produce a corrupt
image every time.
--------------------

The manual for the _upstream_ version of the netpbm says:

  | ppmquant is obsolete.
  ...
  | Note: The reason ppmquant was changed in Netpbm 10.19 is that for some time before that,
  | ppmquant had a serious bug that would have been difficult to fix -- it chose the wrong color set.

Using 'pnmquant' instead of 'ppmquant' fixes the problem I described above, but
a larger problem remains: latex2html still uses ppmquant. An easy fix would be
to remove ppmquant and replace it with a wrapper for pnmquant.

I have not submitted a separate bug report for latex2html because the real problem
is in netpbm.

Regards,

Matthias