PDA

View Full Version here: : JPG and then there's JPG


rogerg
04-06-2007, 09:28 PM
I have made an interesting discovery, perhaps confirming something that I had long suspected...

I just saved an image as a JPG from Canon's Digital Photo Professional 2.0, at level 9 compression, resulting in an image 1000 pixels wide and 168kb in size.

I then openned the saved JPG in Photoshop 5.5 to resize it down a little to be under the IIS 150kb limit. I resized the JPG down to 900 pixels wide and saved it. Doing so the file ended up beign 209kb in size!

The file had decreased in pixel size but had increased in filesize! This seems to confirm (without extensive testing) that the following is true: Newer/smarter software is able to compress a JPG at the same compression ratio to a smaller filesize. Perhaps newer software utilises smarter algorithims?

I often see vast differences in what people manage to fit in to the 150k limit of IIS uploads for JPG's, I wonder if this is a factor as much as the compression ratio actually chosen.

Makes me wonder if it's the best reason yet for me to upgrade my version of PhotoShop.

Roger.

[1ponders]
04-06-2007, 09:57 PM
My preference has always been to use Photoshop's "Save for Web" option. For me it provides the best of both worlds, I can select the quality level and image size and mix and match them until I am happy. The bonus is it can be done with the original open beside the jpeg being modified so I can see the differences immediately and backtrack if I'm not happy with the results, and start again.

rogerg
04-06-2007, 10:11 PM
I think my version of Photoshop was released before the use of images on the web was popular enough for such an option :lol:

Omaroo
04-06-2007, 10:21 PM
Are you sure that you are saving the jpegs to the same colour bit-depth in both applications?

You might also find that Photoshop is designed to be used in a print environment. This being the case, ICC profiling (technology that defines how to store information on the colour curve, and how it performs on various press footprints in relation to how it looks on a calibrated screen) data is inserted by default for you. You have the option to turn it off. Also, jpg compression levels such as "0-9" are relative to the software being used, and are not based on a definitive scale. I do what Paul does and use the "Save for Web" option - it works a treat and is easy to use to gauge the tricky size/quality ratio.

Cheers
Chris

rogerg
04-06-2007, 10:39 PM
PhotoShop says it's 8 bit when loaded and when saved, I don't have anything more than that to go on, so am not positive..



I guessed that would likely be the case but wasn't positive, so that leaves me with little than visual clarity to go by.

In this situation my main judgement is the fact that the original smaller filesize JPG looks visually sharper than the smaller copy saved by Photoshop.

Roger.

okiscopey
04-06-2007, 11:46 PM
'Saving for web' creates a file without an embedded 'preview' image (and may well strip out other data as well). This saves quite a lot of kilobytes, and the percentage is higher the smaller the original file. It's incredibly effective with web and avatar-sized images.

Here's a test I just did on a mid-size 1062 x 750 pixel image with CS2, looking at the saved file sizes on disk:

TIFF: 2.4Mb
JPEG level 10 ('maximum'): 160kb
'Save for web' JPEG 'maximum' quality: 128kb

iceman
05-06-2007, 12:02 AM
"Save for web" is what I use too.

Roger I notice that quality difference too, but I think it's more a case of people not utilising the tools to their full potential, or using the wrong tools.

FOr example, i've seen some inexperienced in image editing saving them as 2000px wide jpegs, and so the compression is absolutely horrible in order to get it under 150k.

I guess for us planetary imagers we're quite lucky. I've been able to save quite big planetary image composites and 40% save-to-web compression and the compression artifacts are still not really noticeable unless you *really* look for them.

I've noticed for deep-space images it's much tougher to get good compression without artifacts.

gary
10-06-2007, 09:11 PM
Hi Roger,

Unfortunately, this is not true and unfortunately a detailed explanation would
require considerable amount of time and background information.

JPEG falls into a class of lossy compression algorithms. At its heart there is
an algorithm we engineers refer to as a Discrete Cosine Transform (DCT),
which is similar to a Fast Fourier Transform (FFT). Essentially the DCT takes
information from the spatial domain into the frequency domain. Since the
lower frequency components contain the most information from a human
perception viewpoint, the lossy part of the JPEG algorithm includes a
stage called quantization where higher frequency components can be
pruned, hence reducing the amount of data storage required. Finally, a form
of compression known as entropy encoding is used to compress the data further.

Thus, the magic that occurs in the JPEG algorithm is far removed from
the number of pixels by number of pixels your image happens to be.

Keep in mind that since the image is encoded, another program is required
to decode it so as to display it on your computer screen or to allow your
printer to print it. As you can appreciate, if someone were to come up
with some new, clever proprietary encoding scheme, then other
programs would not be able to decode it.

By the way, JPEG treats color images as essentially three images in different
colors.

The above is greatly simplified, however, the key to understanding JPEG
is understanding that the DCT and quantization steps take place in the
frequency domain and not the spatial domain.

A good analogy is talking on a telephone. Though only a relatively
narrow band of frequencies are able to be transmitted down the
phone lines and the audio sounds "clipped", we usually can understand the
speaker at the other end, since the bulk of the frequency ranges that
contain information to the human ear are preserved.

Data compression is a very interesting topic with deep mathematical
and even philosophical underpinnings.

I hope this helps.

Best Regards

Gary Kopff
Wildcard Innovations Pty. Ltd.

Barrykgerdes
12-06-2007, 06:01 PM
Hi

When saving a jpeg file in photoshop you should have seen a window that gives the option of the amount of compression to use. The default value is the least compression. There are 10 steps from 1 to 10. I usually use medium which is 5 on the scale.

Barry