I recently opened a jpeg and a tiff of the same subject in Photoshop CS3. They both were made with a Nikon D300, and both had a file size of almost 35mb. If I checked the image info it said the jpeg was about 4mb, which sounds normal. But, CS3 says different. I've tried different reformatted cards and my D200 as well. In Aperture2 the image file sizes are right at 4+MB for the jpeg and 35mb for the tiff. I've reset the preferences in CS3 and the file sizes are the same. The ppi resolution for both images are 300ppi. What am I missing? The first thing that alerted me was when CS3 was having to read the jpeg then rotating the image. This took about 20 seconds, something I never noticed before. I always thought that straight from the camera a fine large setting for a jpeg would be different from a tiff. Help explain this please.

for accuracy, the data would have to be actually compressed after each edit, but that is certainly too time-consuming for just showing a number on status bar;

you might choose another format or compression level when saving the image.

Uncompressed size is useful as you'll know how much memory is currently used to hold the image and you can calculate how much compression, cropping and/or resizing you'll have to apply to reach desired file size.

But doesn't the camera compress the image when you shoot a jpeg? The amount of compression dependent on whether you want fine/basic quality or large/medium/small image size. I understand that you can apply an additional amount of compression when you chose a quality setting when you save the image. Why would the camera record a jpeg image at the same file size as a tiff, at least as interpreted by CS3?
–
owen murphyAug 25 '11 at 16:09

6

It doesn't record it the same size as the Tif, the uncompressed filesize is the amount of memory the file is using up in the programs memory as you are viewing and editing it. To view a compressed file like a jpg, the program has to uncompress it to deal with the data, like opening files in a zip file which has compressed them.
–
DreamagerAug 25 '11 at 16:12

The screen shot maybe explains the situation better. The info on the images shows them the jpeg at 4.2mb and the tiff as 35.8, yet the image size for the jpeg in CS3 shows 34.9mb for the same jpeg image. This is the part I don't get. I starting to feel like a complete idiot on this.
–
owen murphyAug 25 '11 at 16:48

@owen We don't have access to your computer, so we can't see your screenshot. CS3 shows you image size, which is not the same as file size - image has been compressed when storing into file and gets uncompressed in computer's memory when opened in Photoshop. Thanks to compression, file size can be significantly smaller than image size.
–
ImreAug 25 '11 at 17:10

TIFF and JPEG files are "containers" for image data. TIFF are often compressed losslessly — like a .zip file — or sometimes, not compressed at all. JPEG files have a similar lossless compression, but also discard data so that there's less information to store. So you take the full bitmap image and squish it down into a smaller file. The algorithm attempts to discard data that humans won't notice — kind of like how mp3 audio files discard high frequency noise.

However, when you go to display an image, the data gets reconstructed from the file into a simple bitmap: an array holding 8 bits per color × 3 colors × the image width × the image height. As an aside, it's possible to have other color depths, but don't worry about that just here. The point is, regardless of how you've stored them, the actual image unpacks to this collection of data, where the space required is simply based on the dimensions, not the content. This uncompressed image is what is displayed, and what you work with in photoshop.

Even though you initially compressed in a way that discards data, once rendered into viewable or editable form, the places for the image data are the same: still the same-sized buckets for storing information, and still the same number of them for the same image resolution. A flat-color solid black uncompressed image takes the same space as a very detailed photograph — even though there's more information in the detailed one, there's the same amount of data required for display and editing.

This has a key repercussion, which is that the compression is "lost". If you used a compression that keeps all the data (like that normally used by TIFF, PNG, or PSD), there's no real problem: if you save again, it's different, but still lossless. However, when you save again as JPEG, you go through the process of throwing out information all over again, meaning your image gets worse every time you re-save.

Many image editors try to recreate the compression parameters used in the original JPEG when re-saving, so that as long as you haven't changed the file much, the incremental loss is basically just rounding errors. However, if you've made a lot of changes across the image, that won't help.

In practice, you can resave a JPEG several times before there's anything you might notice even on fine inspection. But it's best to minimize the number.