Quote:
Sorry I don't understand !

|
Wow, tough stuff to explain, especially because i'm neither an expert nor a mathematician!
All I think i can say is something along the lines of-
- Because fast memory used to be so expensive, early computer displays were based on colour "lookup tables". Each dot on the screen stored a number, say 0-15 or 0-255, and then that number was "looked up" to see what colour to display for that pixel. With this type of display you have a lot fewer possible colours (say 255) than dots on the screen (maybe a million+) so it is possible to design compression schemes that take advantage of this fact. "Runlength encoding" is one that only really works for images with blocks of constant colour (e.g. a graph from a spreadsheet, or a cartoon). The GIF compression scheme is more general, but only work on images of up to 256 colours (i.e. a lookup table type image) and still works best on images predominantly made up of a small number of colours.
- Modern computer displays, camera sensors, and image file formats typically use an 8 bit number (0-255) for the red, green and blue (RGB) component of every dot on the screen, that's 16 million possible colours for ANY dot. That means, in theory, every dot (pixel) in an image could be a differnt colour. On that basis compression schemes that look for similar colours and sort them into groups aren't going to work.
- Instead, schemes like JPEG look at the frequency components of an image. Think about it- describing an image that was just a big block of one colour (say blue) would be very simple, no matter how big (in pixels) the image was, a single colour block image compresses very easily, the more the colours vary, the more information you need to describe the image. Real world images tend to be made up of smoothly varying colours and shapes rather than sharp edges. For one dimensional signals (something like a radio wave) the Fourier transform describes the wave by breaking it down into it's sine wave frequency components. In the process the Fourier transform is a greatly compressed description of the original signal. JPEG is based on a Discrete Cosine Transform (DCT) that does something similar, but in two dimensions, and using the cosine function rather than the sine. It analyses the colour of areas of the image, and then the frequency distrbution of how the colours vary in the X and Y directions. Hence JPEG does a great job on images with smoothly varying colours, like photos of people, animals etc. It's not so great on "un-natural" blocks of sharp colour changes because these have lots of high frequency non-repeating colour change components so they don't compress well. JPEG is "lossy", it actually throws away some high frequency data, more as you reduce the quality setting, so you'll find JPEG a poor solution for compressing images containing things like Excel graphs or text because after compression the resulting image will ofthen have changes (compression artifacts) that are noticeable.
Sorry that doesn't actually explain how it works, but to be honest that's well beyond my level of knowledge and mathematical ability. As very few of us can really grasp the maths, we are best to stick to a simple set of guidelines-
- Non-photographic images up to 256 colours- Use GIF or 4 or 8 bit PNG (GIF is actually a proprietary format, although most of uis ignore that).
- Photographic "real world" images with any number of colours- Use JPEG (maybe JPEG2000 in future).
- Computer-generated images with blocks of flat colour and/or text that you don't want corrupted by the compression process- Use PNG, TIFF, or the many non-compressed formats like BMP.
I hope that helps a bit. If you want to know more there are a million papers describing compression schemes on the web, but most are heavy on the maths, it's the nature of the subject i'm afraid.
Reagrds: colin_e