From: tgl+@cs.cmu.edu (Tom Lane)
Newsgroups: comp.sys.mac.apps
Subject: Re: JPEG decompressor? (Summary)
Keywords: JPEG, JFIF, Viewer
Date: 26 Aug 92 22:41:26 GMT
Article-I.D.: cs.BtM4D3.1yC.2
Organization: School of Computer Science, Carnegie Mellon

sears@cello.hpl.hp.com (Bart Sears) writes:
> I have not been happy with _any_ of the Mac jpeg viewers or
> converters.  (I have tried imageryjpeg0.6.cpt.hqx and
> jpegview1.1.cpt.hqx. ...

Yeah, color quantization is not done very well by any of the available Mac
viewers.  Imagery JPEG 0.6 is awful (which I can say since I wrote the
quantizer it uses :-).  All the other ones use the QuickTime quantizer which
isn't very much better.  Both quantizers, as you point out, use a fixed
colormap for speed reasons.

> Has anyone written a gif_to_jpeg converter for the mac based on the
> ppmquant program from Jef Poskanzer pbmplus package?  This ppmquant
> routine is the same one used in xv for the "best24" conversion
> routine.  If such a program doesn't exist, I may try putting one
> together as I don't feel that any of the current jpeg_to_gif (or
> jpeg viewers) do a reasonable job of converting/displaying jpeg files.

I wouldn't recommend that.  With all due respect to Jef, the ppmquant
algorithm is horribly slow and doesn't produce all that great results.
In my biased opinion, the IJG v3 quantizer does noticeably better on
most images, and it's certainly a lot quicker.  If you have xv 2.21,
comparing JPEG display in "slow" and "best" mode might be enlightening,
although it's hard to ignore the effect of dithering vs. not dithering.

As Paul Jacoby pointed out, the next release of Imagery is scheduled to use
the IJG quantizer.  Also, JPEGView's author is looking into using the IJG
quantizer in place of QuickTime's quantizer.  It may be a while before we
see any results from these efforts, but they're coming.

I don't know of any plans to build a Mac JPEG viewer that will rely entirely
on the IJG code and not need QuickTime.  It would be nice to have such an
animal for those whose machines are too old to run QuickTime.  Anybody want
to step up to bat?


Oh, one minor nit:

> On the otherhand, all of the mac programs seem to pick a _fixed_
> palette of 256 colors for _all_ images.  They then dither the picture
> to try and make it look good using only those colors. ... They do this even
> if the jpeg file doesn't use more than 256 colors!

Bzzt.  You were doing fine up to that point, but there AIN'T NO SUCH THING
as a jpeg with only 256 colors (unless it's grayscale).  Even if you start
with a 256-color GIF input --- not recommended, by the way --- the raw
output from the JPEG decompressor is much more than 256 colors.  I was about
to say, "see the JPEG FAQ", but after looking I realized that this isn't
clearly spelled out in the FAQ.  Oh well, the next posting will say this:


Since JPEG is a full-color format, converting a color JPEG image for display
on 8-bit-or-less hardware requires color quantization.  This is *always* the
case: even if you feed a 256-or-less-color GIF into JPEG, what comes out of
the decompressor is *not* 256 colors, but thousands of colors.  JPEG's
lossiness affects each pixel a little differently, so two pixels that
started as identical colors will probably come out as slightly different
colors.  Each original color gets "smeared" into a group of nearby colors.
Therefore quantization is always required to display a color JPEG on a
colormapped display, regardless of the image source.  (Incidentally, because
of this effect it's pretty much meaningless to talk about the number of
colors used by a JPEG image.)


			tom lane
			organizer, Independent JPEG Group
Newsgroups: comp.sys.mac.apps