Rotating photo changes file size.??? Newbie question

Discussion in 'Digital Cameras' started by QX, Oct 8, 2006.

  1. QX

    QX Guest

    Greetings all, Newbie here.
    I just experimented with a photo I took, where I had rotated the
    camera 90° when I made the exposure . I downloaded the image to my PC,
    and pasted it several times into a folder, naming each image something
    different. Then I rotated them back to the proper perspective. I used
    4 different programs to do the rotation. Here are the results based on
    the Win XP file properties screen for the photo:
    Original: 4,131,074 bytes 3.93 MB
    ======================================
    LView Pro 1,146,333 bytes 1.09 MB
    MS Picture It 2,007,928 bytes 1.91 MB
    WinXP 4.131.211 bytes 3.93 MB
    PS Elements 5,674,023 bytes 5.41 MB

    ..
    Can anyone explain why there is such a great difference in resultant
    file sizes between the different programs I used to rotate the image?
    (WinXP, I right clicked on the image, and selected <Rotate Clockwise>
    from the popup menu)
    Of particular interest is why the WinXP is slightly larger than the
    original, and why the PS Elements is so much larger?
    ..
    Based on the results, it would appear that I should use the WinXP or
    PS Elements to rotate images, for the largest (less loss) files.
    ..
    Does the group concur? or is there a better program to use?
    Thanks in advance
     
    QX, Oct 8, 2006
    #1
    1. Advertisements

  2. If you want to rotate a JPEG by exactly 90 degrees, you can do that in a
    lossless manner, and only Windows XP does that of the programs you tested.
    I would therefore suggest Windows XP, and avoid the others which are
    damaging your data.

    (Actually, there are free programs which will also do lossless JPEG
    rotation).

    David
     
    David J Taylor, Oct 8, 2006
    #2
    1. Advertisements

  3. David has explained the reason. However, I would recommend using a
    program with support for lossless rotation of JPEGs that isn't Windows
    XP. Windows XP rotate has a bug, so that it requires the dimensions of
    the JPEG to be dividable by 16, in order to perform lossless rotation.

    IrfanView, with the plugin pack, supports lossless rotation of JPEGs.
    A long list of programs can be found at
    http://sylvana.net/jpegcrop/losslessapps.html
     
    Toke Eskildsen, Oct 8, 2006
    #3
  4. You cannot rotate losslessly /unless/ the JPEG has a size which is a
    multiple of 8 or, more likely 16, pixels. That's because of the way JPEG
    works, encoding the image into blocks of 8 or 16 pixels sqaure, it is not
    a defect of the Windows XP pitcure rotation. If you "losslessly" rotate
    an image which does not have that size, then the edge pixels in the
    resulting image will have been subject to lossy rotation. Perhaps that
    won't be noticeable as it will affect a small band of 8 or 16 pixels near
    the image edge.

    There are also programs which can losslessly crop as well - again in 8 or
    16 pixel steps.

    David
     
    David J Taylor, Oct 8, 2006
    #4
  5. David J Taylor wrote:

    [Toke: Windows XP ... requires ... dividable by 16 ... lossless]
    That is correct. It ties to the chroma subsampling. As fas as I
    remember, it is even possible to construct JPEGs, where the dimensions
    needs to be multiples of 32. But that's not something one would
    normally do.

    The the vast majority of digital cameras produces JPEGs where the width
    needs to be a multiple of 16 and the height a multiple of 8, in order
    to be losslessly rotated. Fortunately the same majority of cameras
    produces such images with dimensions that fit that description.
    Yes it is. You will notice that I wrote 16, not 8. Windows XP cannot
    losslessly rotate JPEGs that are, for example, 32x24 pixels, no matter
    how the blocks are specified in the JPEGs.

    You could also call it a severe shortcoming, if you don't like the
    description "bug".
    It is my experience that it is quite visible on most pictures.
    I definitely prefer to throw away the non-losslessly-rotatable pixels.
    Actually the cropping is a bit more flexible, as it is only the upper
    left corner, that needs to be a multiple. The lower right corner is
    free from these constraints.
     
    Toke Eskildsen, Oct 8, 2006
    #5
  6. Well, it depends (to me) on how it is documented. If the description says
    "will rotate images which are a multiple of 16 in size" then I would call
    it a "limitation" or "constraint". If the documentation says "multiple of
    8" then I would agree it's a bug.
    So you would crop before rotation? Or let the program do that. It sounds
    a good approach to me.
    I haven't looked at the maths enough to know whether that's true or not
    (the part about allowing an arbitrary size when cropping). My gut feeling
    is that it doesn't sound right, but perhaps an expert like Dave Martindale
    will spot this thread and comment.

    David
     
    David J Taylor, Oct 8, 2006
    #6
  7. jpegtran can do both: Automatically crop or leave the non-rotatable
    pixels.

    However, it is not very often I encounter an image that requires this.

    Toke:
    No need. Fetch jpegtran and try it out:
    jpegtran -crop 123x123+16+8 in.jpg out.jpg
    produces an image of ... 123x131 pixels?

    Let's see...
    jpegtran -crop 123x115+16+8 in.jpg out.jpg
    produces an image of 123x123 pixels.

    Seems like there is a little bug in the Windows version. Anyway, the
    conclusion is the same: Cropping does not have the constraints on size.


    (okay, this is not a proof, since there could be recompression
    involved. But to my knowledge, jpegtran isn't capable of doing a full
    recompression)
     
    Toke Eskildsen, Oct 8, 2006
    #7
  8. I'll wait for Dave M's comments, before drawing any conclusions from what
    may be a flawed program or implementation.

    David
     
    David J Taylor, Oct 8, 2006
    #8
  9. Many thanks for the explanation, Martin.

    []
    Many thanks also for the clarification about the limits on lossless
    rotation. I read what you say as: "Given a change to the JPEG spec we
    could handle arbitrary size rotation, but not right now".
    I haven't used IrfanView for that (as I have other software), but if it's
    as good at lossless rotation as at everything else it does, I can believe
    you!

    Cheers,
    David
     
    David J Taylor, Oct 9, 2006
    #9
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.