Compression

greenspun.com : LUSENET : Imaging Resource Discussion : One Thread

I am a true nyophite to both tradional photography and digicams. I read the "Myths", but wonder how compression plays into this. I have noticed that in one of my photo programs I have four levels of compression for JPG files. All things being equal, what would be the difference between a 1600x1200 at the highest level of compression and a 800x600 at the lowest.

I am very confused. Do you have a copy of "Myths" in PDL that I could download and study?

Thanks

John Wales

-- John Wales (jncwales@gower.net), March 22, 2000

Answers

John:
Compression is not the evil it is often characterized as. It is a tool. Like any tool, it can be abused and/or misused.
There are different kinds of compression. There is JPG compression (used in images and movies), MPEG compression (primarily used in movies), LZW Compression (used in images like the common GIF and TIF formats), and others. There are also variations of compressions even within the types listed above. For example there is MPEG1, MPEG2, MPEG3, MPEG4... These are not necessarily updates, rather they are often targeted for different mediums (video, audio).

Before you proceed please remember...
If you're not confused, then you don't understand.

Lossless Compression
Some compression is lossless. Let me give you an example of lossless compression. Say an image consists of binary data that looks like this:
1010100000011110100000000
A lossless compression could represent this same binary data as:
10X3,0X5,1X4,01X1,0X8
Now this is not an actual example, it's illustrative. You can see, however, that the resulting data uses fewer characters to represent the exact same thing. The original string of data can be perfectly reproduced using the information from the second. Lossless compression is a much simpler form of compression and 2nd or third year Computer Science students can usually master algorithms for these. Lossless compressions can also be applied equally to any situation where compression is desired. Pictures, Financial Data, Text, Database, etc.

Lossy Compression
Lossless compression is limited in its ability to provide real value in some key areas. Music, Pictures and Video are examples where lossless compression doesn't do enough to be broadly worthwhile. Compression schemes that are useful in these areas have to be smart. Lossy compression results in significant data compression because it actually throws data away. In other words, you cannot recreate the original from the compressed version. Some will argue that this is no longer compression. A better term might be decimation - though I find that a bit harsh. Lossy compressions have to be targeted for specific purposes. For example, a lossy compression for video can result in tremendous savings in file size. The compression algorithm has to choose which pieces of data to permanently remove. The choices will be different depending on what is being compressed. While some generalized algorithms can be applied to video - much better compression ratios can be achieved if the algorithm knows specific information about the data it is to compress. For example: MPEG2 can compress color video to a fraction of it's original data-size because it knows a great deal about color video. If you subscribe to Direct TV, or the Dish Network (my favorite) you are receiving highly compressed video signals based on MPEG2 compression. This allows these companies to deliver 500 channels of service on a data-stream that could only carry a handful of uncompressed video data streams. The truth is that the video quality is not as good because it is compressed. The MPEG compression tries very hard to select which parts of the image it throws away - and in most cases it makes decent choices. It looks at different parts of each frame of video and evaluates them separately. It looks at motion vectors, image detail, color, and ancillary data outside the field of view. If it determines you don't need portions of the frame - it won't include it.
Different compression schemes use different methods. Some are better then others - depending on your goals. For example: If your goal is to shove 500 channels down a limited pipeline you must choose a compression scheme that significantly reduces data size and considers quality secondary (sorry). If quality is more important then you choose something else. Most of the compression schemes are scalable - that is you can tell it to compress for high quality, or small size. The more you compress the less quality you get.
Now to your specific question: "what would be the difference between a 1600x1200 at the highest level of compression and a 800x600 at the lowest (?)"
It depends...
Since the compression algorithm for a JPG image has to be smart it will look at the picture before it compresses it. It will apply subjective algorithms and permanently delete portions of the image. This is a very inhumane, but efficient process. It will result in compression artifacts which are objectionable some of the time. If there is a lot of straightedge geometry in the image then significant compression can create a pretty nasty result. If it's an image full of flowing soft textures and expansive gradients - a lot of compression may not even be noticeable - it really doesn't matter if it started out at 1600 X 1200 or 800 X 600.
For my money I'd stick with shooting for the extra detail the higher resolution original will give you - then compress to your target size. You may need, however, to save space on a memory card so you can take more pictures - and so you may then have to choose to shoot at lower resolution. So you see - it depends. It depends on your needs. It depends on your desire. It depends on your resource. The factors can spar, but you must choose what it appropriate (quality, size, more memory card$). Ain't life full of choices....

Des

-- Dan Desjardins (dan.desjardins@avstarnews.com), March 23, 2000.

Moderation questions? read the FAQ