In article <u9k1d5-b122.ln1@[EMAIL PROTECTED]
>, SteveB
pittmanpirate@[EMAIL PROTECTED]
says...
> I take 640 x 480 pictures for real estate evaluations. We use this size
> because they go through e mails quicker.
>
> When I download them to my computer, and then put the mouse arrow on
them,
> they always say 640 x 480, but the kb size varies. Why is that?
>
It depends on the content and the compression level and image format
used.
Consider the most basic way you could store the image - 640x480 is
307200 pixels. Each of those pixels has a level of red, green and blue
light. If each colour can have one of 256 levels you can store its
information in 3 bytes, so the file size will be 921600 bytes or 900kB
(plus a few extra at the start of the file to say what sort of image it
is, that it's 640x480 pixels and 3 bytes per pixel). Thats a basic
uncompressed bitmap image.
Now consider what happens if several consecutive pixels have the same
value - instead of representing each one, you can just give the value
for one pixel and the repeat count. With the uncompressed bitmap you
always need 3 bytes per pixel, but using this method (called run length
encoding) you can represent up to 256 pixels using only 4 bytes, 1 each
for RGB and one for the count. The downside of this is that in the
worst case you could end up using 4 bytes per pixel and produce a larger
file because none of them is repeated, but even if only a quarter of the
pixels are repeated once the file is no larger, and as soon as pixels
are repeated more than once you start to save space. That's a simple
form of lossless compression - when decompressed again the image is
identical to the original.
Finally consider what happens if a group of pixels are approximately the
same value - after all, 3 bytes can store 16,777,216 different colours,
and you probably don't need that many. So take an average value of a
few similar pixels, and store them as if they are all identical. That
can greatly increase the incidence of a run of pixels, further reducing
the file size. The problem with this is that you can't rebuild the
image exactly from its compressed form - it's lossy compression, because
some of the information about the original image has been discarded to
save space. This can sometimes be seen in highly compressed images -
what should be a smooth gradation of colour, like a clear blue sky that
lightens slightly towards the horizon, can actually be seen as distinct
steps where the colour changes suddenly.
There are more elaborate compression methods (and other simple ones)
usually working in two dimensions rather than just the one, and using
complex mathematics, but those are pretty much the basics.
If you're interested you could download something like Irfanview (a free
image viewer/editor) and experiment by saving different types of image
at different sizes, compression levels and colour depths to see what
effect it has on file size and the appearance of the image.


|