I designed and wrote ppmdist, which is a part of the
netpbm
package of graphics utilities.
ppmdist isn't all that different from
ppmtopgm in that it converts from color to greyscale, except that if you have
a color image having (just for example) three colors - the background, and
some foreground stuff in a red and a green in an unfortunate brightness ratio, then with
ppmtopgm it'll be hard to tell apart the red from the green in the resulting
image. With ppmdist, the (grayscale) contrast between the red and green is maximized,
making it much easier to tell them apart.
ppmdist works best with low-color computer-generated images.
- If you use it on
something with a lot of colors, it's pretty hard to tell any difference
from ppmtopgm. That means that today's antialiased text output doesn't benefit that
much from ppmdist, because antialiasing uses lots of colors to simulate higher
resolution.
- However, sometimes you can get a good result by piping your high-color image through
something like "ppmquant 6" first.
Here are 3 example images to show what ppmdist does. Granted, I've carefully picked the red and green intensities:
- This is a color image:
- This is that same image, converted with ppmtopgm:
- This is that same color image again, converted with ppmdist. Note that the shades of gray are
distinguishable from each other:
Hits: 2432
Timestamp: 2024-12-27 08:37:06 PST
Back to Dan's tech tidbits
You can e-mail the author with questions or comments: