View Full Version : Pixels & Bytes
Rusty
August 22nd, 2007, 03:59 PM
We have had some really good threads on an old friend subject - resolution.
I have hopes that some of the usual suspects can come in and explain to me what's happening when Jpeg files are saved. I understand why some files are lossey and some are not and I understand how resizing can change pixel size. But I'll be darned if I can figure out the "save routine". In all of the below examples I opened a "from the camera file".
http://www.pixentral.com/hosted/1ZYleegGIwBFZT2Pn3ofljjFtKhl_thumb.jpg (http://www.pixentral.com/show.php?picture=1ZYleegGIwBFZT2Pn3ofljjFtKhl)
In all instances it was Open > Save > Close. Then I reopened the original again and repeated the routine.
The original filesize was 3008 x 2000 pixels and that was completely unchanged following every save routine (I didn't expect it to change). I know "bytes" on my PC are not the same thing as "pixels" within an image, but I don't understand what's happening.
Compare the original byte-size with the byte-size resulting from various save quality options:
Original 3008x2000 pixels = 1.47MB
Jpeg 12 (maximum) = 2.53MB
Jpeg 8 (high) = 756KB
Jpeg 5 (medium) = 458KB
Jpeg 2 (low) = 312KB
Because I am a high school graduate, I know 2.53 is bigger than 1.47 so I will jump to the conclusion that there is more of something in that file to make it bigger. Because 312 is less than 458 I guess there is less of something in that file.
If I take these 4 files and use the marquee tool to crop the exact same thing, I can't see a heck of a lot of difference. Elements is still telling me that every one of these files is 3008x2000 pixels.
http://www.pixentral.com/hosted/1Q5p5trugdEv3sv3CoAovNC1HhiYn1_thumb.jpg (http://www.pixentral.com/show.php?picture=1Q5p5trugdEv3sv3CoAovNC1HhiYn1)
Maybe I need to waste some paper and ink and crank out some 8x10s to see a difference?
Rusty
RobertSchuldenfrei
August 22nd, 2007, 04:55 PM
Hi Rusty,
You answered your own question. You do have to waste some paper and ink. I did exactly the same experiment with 12, 10, 8, and 6. And just like you, the 12 increased the file size. This led me to conclude that JPEG was making up pixels! I now use 10, not 12.
Armed with my trusty 8X loupe I investigated the four images. I could see a difference with the loupe between 10 and 8, but my unaided 64 year old eyes could see no difference. Even my poor eyes could see a degradation at 6.
Keep in mind there is another variable in this mess. You just knew there had to be:). It is your printer. This is why you need to waste the ink and paper. How your printer changes those pixels into dots (yes gentle reader, here is where we actually mean dots) is another place to loose resolution. So, no matter how good I tell you 10 is the JPEG magic number for me (Canon S9000), you are just going to have to find out for yourself. Resolution is an end-to-end issue: Camera -> Computer -> Printer.
Let us know what works for you Rusty.
Cheers,
Bob
Byron Gale
August 22nd, 2007, 05:06 PM
Rusty,
The number of pixels remains constant - the variable is the compression level in the JPG algorithm.
Higher quality = less compression = more bytes.
Lower quality = more compression = fewer bytes.
The catch is that, as you know, JPG is "lossy", so cannot completely regenerate all of the data it throws out when it compresses... so the more you throw out, the worse your image may look when it is reopened.
Byron
edit to add: Your JPG image straight out of your camera has some level of compression applied by the camera. In your case, that level equates to somewhere between PSE's quality settings of 8 and 12. That's why a "8" is smaller, and a "12" is larger, than the "fresh" file size.
GaryK
August 22nd, 2007, 07:04 PM
Rusty
I don't quite get what happened with the 12. Mind you I don't "get" a lot of stuff.:)
I'm not sure if you get compression or not. If so, NEVERMIND.:D
I kind of look at it like division and rounding. If you take a number and divide it, and round to the nearest whole number, then multiply it back. Sometimes the number is right sometimes not. In my mind, the compression factor, is how many decimal places the number rounds to.
Now that doesn't explain the 12 setting though.;)
LeeOtsubo
August 22nd, 2007, 07:51 PM
It would be helpful if you gave us a bit more info such as the camera make & model as well as the size & quality settings you used. In Canon, a Large/Fine jpeg from a 6MP sensor would yield about 2.4MB files. To produce a file as small as 1.47MB, the camera would be set to a lower jpeg quality and/or smaller size.
Briefly, in very simplistic terms, jpeg works by lumping together like pixels. Imagine a photo of an American flag. The circuitry "examines" the first (top left corner) pixel and declares it "blue" (blue field of stars). It examines the next pixel and declares it to also be "blue". Eventually, it runs into a white star and declares that pixel "white". When it gets to the first stripe, it "sees" red. All pixels from that point to the end are red. So, theoretically, the circuitry has written down a series of blues, whites and reds. It repeats this for all 6 million pixels in a 6MP sensor.
When jpeg compression is invoked, it looks at the first pixel and sees blue. It then looks ahead to see how many blue pixels are in sequence. If there are 50 blue pixels, it simply writes "blueX50" which is much shorter than writing "blue" 50 times. Are you still with me? The level of compression is determined by the threshhold. So, if a low level of compression is applied, only "blue" and blues that are within a narrow range are included. Blue plus 10 might be considered blue but blue plus 11 would be considered "darker blue" and blue minus 11 would be "lighter blue".
A high level of jpeg compression accepts a wider threshhold of blues as "blue". Therefore, more pixels are lumped together as "blue" when, in reality, they might actually be 3 or 4 or 5 discernable shades to the human eye. This creates banding.
As to why the file size increased when you used jpeg level 12, the software interpolated (fancy word for guessed) where large swathes of similar colors should be broken up. PSE looked at the file and decided that there was too much difference in certain "lumps" (categories) of color and divided it into finer "lumps". This increased the granularity (lumps) and your files size increased.
Hope that makes sense. BTW, Sony has been notorious in the past for "stepping on" files much harder than, say, Canon or Nikon. JPEG is a fine tool but, like any tool, should be applied with finess. It shouldn't be slathered on like a PB&J. Some camera companies slather it on because they know most snapshooters will never know the difference and it makes the teeny-tiny included memory card seem huge.
If you really want to understand digital photography, sign up for one of my live, on-line classes.
Tom K
August 22nd, 2007, 07:52 PM
Rusty
If you want to look at some interesting reading on jpg files start
with this link.
http://graphicssoft.about.com/od/formatsjpeg/a/jpegmythsfacts.htm
If you follow all the links to the end - we will have to find a rubber room
for you. After a while it just gets toooo deep.
Tom ;)
Rusty
August 22nd, 2007, 09:02 PM
Thanks, I will explore suggested link, Tom - hopefully I'll understand something before my eyes start to glaze over :)
Thanks, Lee, I forgot that Save For Web strips out the Exif data
<a href="http://www.pixentral.com/show.php?picture=1rXU7YNR60McvrumlmF01feT4n"/><img alt="Picture hosted by Pixentral" src="http://www.pixentral.com/hosted/1rXU7YNR60McvrumlmF01feT4n_thumb.jpg" border="0"/></a>
If you can't read this... Nikon D50, Normal Quality Setting
I knew compression had something to do with it. I just have to study some more to understand.
Ruaty
try that link again:
http://www.pixentral.com/hosted/1rXU7YNR60McvrumlmF01feT4n_thumb.jpg (http://www.pixentral.com/show.php?picture=1rXU7YNR60McvrumlmF01feT4n)
RobertSchuldenfrei
August 23rd, 2007, 12:53 PM
Hi Rusty,
I wonder if you ever did the printing experiment? On a slightly off topic question, did you ever take the pictures of the church doors? How did they come out?
Cheers,
Bob
Rusty
August 23rd, 2007, 04:46 PM
Thanks, Bob,
No, haven't spent the ink yet; may or may not.
I'm not happy w/church glass. It "worked" but looks too fake to me.
I'll bring that thread back to life so the people that kindly helped can see what's happening.
Rusty
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.