Compression quandary / question

Discussion in 'Digital Photography' started by Earl Misanchuk, Sep 15, 2006.

  1. I think I understand the basics of compression in JPGs, but I am
    mystified by some observations. Specifically: Olympus E-300 with 14-53
    lens, HQ setting at 1:4 compression, auto exposure. Three photos taken
    at HQ setting, saved as JPGs without modification after uploading.

    Examining EXIF info of those three shots in iView Pro, I find that one
    of them was compressed at 1:5, one at 1:7, and one at 1:17 ( ! ). How
    can that be? The contents of the photos were quite different, which I
    expect would contribute to differences in overall file size after
    compression, but shouldn't the compression ratio stay the same?

    My understanding is that when I set the quality to HQ (1:4), that's what
    the JPGs should be. Can anyone offer any explanation for what happened?

    NOTE: I do know the virtues of saving files as RAW (and even TIFF), so
    please don't give me a lecture on that point. I am simply trying to
    puzzle out the strange observations.

    ADVthanxANCE
     
    Earl Misanchuk, Sep 15, 2006
    #1
    1. Advertising

  2. Earl Misanchuk

    Steve Wolfe Guest


    >I think I understand the basics of compression in JPGs, but I am
    > mystified by some observations. Specifically: Olympus E-300 with 14-53
    > lens, HQ setting at 1:4 compression, auto exposure. Three photos taken
    > at HQ setting, saved as JPGs without modification after uploading.
    >
    > Examining EXIF info of those three shots in iView Pro, I find that one
    > of them was compressed at 1:5, one at 1:7, and one at 1:17 ( ! ). How
    > can that be?


    When you set a JPG compression level, you do *not* specify an exact amount
    (such as 1:4). Just how much compression you'll get still depends upon the
    contents of the photo.

    steve
     
    Steve Wolfe, Sep 15, 2006
    #2
    1. Advertising

  3. Earl Misanchuk <> wrote:
    : I think I understand the basics of compression in JPGs, but I am
    : mystified by some observations. Specifically: Olympus E-300 with 14-53
    : lens, HQ setting at 1:4 compression, auto exposure. Three photos taken
    : at HQ setting, saved as JPGs without modification after uploading.

    : Examining EXIF info of those three shots in iView Pro, I find that one
    : of them was compressed at 1:5, one at 1:7, and one at 1:17 ( ! ). How
    : can that be? The contents of the photos were quite different, which I
    : expect would contribute to differences in overall file size after
    : compression, but shouldn't the compression ratio stay the same?

    : My understanding is that when I set the quality to HQ (1:4), that's what
    : the JPGs should be. Can anyone offer any explanation for what happened?

    : NOTE: I do know the virtues of saving files as RAW (and even TIFF), so
    : please don't give me a lecture on that point. I am simply trying to
    : puzzle out the strange observations.

    What you may not have understood is that Jpeg compression is variable. It
    is not a hard and fast ratio. Any image with large areas of the same color
    compress smaller than the same size area with lots of detail. So if you
    take a photo at night that is mostly dark with a small lit subject in the
    middle would compress very small (all that black compresses to only a few
    digits). But a daytime image with lots of details and small patches of
    color needs lots more data to describe.

    Here's an example of how this works. If you have an image that is 16
    pixels in a 4x4 grid and the entire image is a single color that can be
    called "1", the entire image could be compressed by calling it "1x16"
    (color one repeted 16 times). While the same image space with 16 different
    colors would take more room,
    "1x1,2x1,3x1,4x1,5x1,6x1,7x1,8x1,9x1,10x1,11x1,12x1,13x1,14x1,15x1,16x1".
    As you can see the compression will vary greatly with the subject. And
    this is before the jpeg process gets into its "lossy" formula. BTW this is
    just an example of how discrepancys in compression can happen, not an
    exact description of how the jpeg format works.

    So your example that several images of different subjects were stored at
    different compression ratios is perfectly normal for Jpeg. Even "lossless"
    compression formulas will compress different subjects differently. If you
    want a set file size your only real choice is Raw as this format stores
    the data from each pixel individually with no regard to what values are in
    pixels on either side. So the file size will be very stable. Of course
    this file will be huge as there is no (or nearly no) compression at all.
    (the prior statement is general as some manufacturers flavor of raw can
    work different than others and so may be variable in their application.)

    Randy

    ==========
    Randy Berbaum
    Champaign, IL
     
    Randy Berbaum, Sep 15, 2006
    #3
  4. Earl Misanchuk

    POHB Guest

    Randy Berbaum wrote:
    >
    > If you
    > want a set file size your only real choice is Raw as this format stores
    > the data from each pixel individually with no regard to what values are in
    > pixels on either side. So the file size will be very stable. Of course
    > this file will be huge as there is no (or nearly no) compression at all.
    > (the prior statement is general as some manufacturers flavor of raw can
    > work different than others and so may be variable in their application.)


    Some manufacturer's RAW formats use lossless compression, others do not
    compress. With lossless compression your example of a group of
    identical pixels still applies so the RAW files could vary widely in
    size.
     
    POHB, Sep 15, 2006
    #4
  5. Earl Misanchuk

    Matt Ion Guest

    Randy Berbaum wrote:

    > What you may not have understood is that Jpeg compression is variable. It
    > is not a hard and fast ratio. Any image with large areas of the same color
    > compress smaller than the same size area with lots of detail. So if you
    > take a photo at night that is mostly dark with a small lit subject in the
    > middle would compress very small (all that black compresses to only a few
    > digits). But a daytime image with lots of details and small patches of
    > color needs lots more data to describe.
    >
    > Here's an example of how this works. If you have an image that is 16
    > pixels in a 4x4 grid and the entire image is a single color that can be
    > called "1", the entire image could be compressed by calling it "1x16"
    > (color one repeted 16 times). While the same image space with 16 different
    > colors would take more room,
    > "1x1,2x1,3x1,4x1,5x1,6x1,7x1,8x1,9x1,10x1,11x1,12x1,13x1,14x1,15x1,16x1".
    > As you can see the compression will vary greatly with the subject. And
    > this is before the jpeg process gets into its "lossy" formula. BTW this is
    > just an example of how discrepancys in compression can happen, not an
    > exact description of how the jpeg format works.


    That's a pretty fair description.

    Working in the "lossy" component then, you get something like this:

    Say you have a section of sky, for the sake of argument, a strip one pixel wide
    and 8 pixels long. Each pixel is a slightly different shade of blue - say for
    easy example it goes in a steady gradient from from shade "1" to shade "8".

    Now normal lossless compression would probably not reduce this at all, because
    each pixel is a different value. But set for the highest-quality,
    lowest-compression level of lossy compression, and what you might get is the
    software deciding that the difference is small enough that if pixels 1 and 2
    were the same shade, it wouldn't be noticeable... same with 3 and 4, and so
    on... so instead of a strip of color of shades
    "1x1,2x1,3x1,4x1,5x1,6x1,7x1,8x1,", the software would discard every second
    pixel, and describe it as "1x2,3x2,5x2,7x2,9x2". Those intermediate pixels are
    now gone, so when the image is displayed, it creates essentially a rougher,
    "stepped" gradient. This is why it's called "lossy" compression.

    As you reduce the quailty level and increase the compression, you get smaller
    files, but less accurate color... for example, the next step might start with
    the "2" pixel and discard one pixel to either side... so you'd get
    "2x3,5x3,8"... or it may take the first pixel and discard the next two, for
    "1x3,4x3,7x2". That decision would be made by the software depending on the
    exact content and the specific algorithm used.

    Obviously this is a VERY simplistic description, but it gives a bit of an idea
    of how "lossy" compression works. BTW, MP3 compression uses a similar concept
    on audio files, determining what parts of sound wouldn't normally be noticeable
    (say, a wrist watch ticking on a drummer's wrist while he's playing!), and
    simply discarding that data.
     
    Matt Ion, Sep 15, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MountainCat

    XP image compression question

    MountainCat, Jan 10, 2004, in forum: Computer Support
    Replies:
    2
    Views:
    629
    Boomer
    Jan 10, 2004
  2. Nicholas J. Coscoros

    JPEG Compression (Newbie Question)

    Nicholas J. Coscoros, Jul 29, 2003, in forum: Digital Photography
    Replies:
    5
    Views:
    532
    Bruce Chastain
    Jul 30, 2003
  3. Dan Bjarnason

    Resolution / compression question

    Dan Bjarnason, Aug 26, 2003, in forum: Digital Photography
    Replies:
    3
    Views:
    485
  4. Cheekycharlie

    Laptop Quandary

    Cheekycharlie, Jul 4, 2007, in forum: Computer Support
    Replies:
    4
    Views:
    576
    =?ISO-8859-1?Q?R=F4g=EAr?=
    Jul 5, 2007
  5. Nige Danton

    Quandary - DX or FX?

    Nige Danton, Apr 10, 2013, in forum: Digital Photography
    Replies:
    28
    Views:
    454
    PeterN
    Apr 20, 2013
Loading...

Share This Page