JPEG lossless re-sizing?

Discussion in 'Digital Photography' started by Bob & Anni, Dec 7, 2003.

  1. Bob & Anni

    Bob & Anni Guest

    I know it's possible to do JPEG lossless rotation and cropping but is it possible to do lossless re-sizing as well?
    Starting with large images (pixel count) I use jpegcrop to crop to the required composition but then I want to resize the resulting
    image to fit my web pages.
    --
    Bob
     
    Bob & Anni, Dec 7, 2003
    #1
    1. Advertising

  2. Bob & Anni

    Bob & Anni Guest

    Thinking about this, it's probably only possible to do a lossless resize to 1/2 1/4 1/8 1/16th etc
    Just realised that it wouldn't help me anyway as I need to add a logo and sometimes adjust the contrast or colour, so that would
    probably mean recompressing anyway
    Interesting subject never the less
    --
    Bob
     
    Bob & Anni, Dec 7, 2003
    #2
    1. Advertising

  3. Bob & Anni

    Andy Hewitt Guest

    Bob & Anni <> wrote:

    > Thinking about this, it's probably only possible to do a lossless resize
    > to 1/2 1/4 1/8 1/16th etc Just realised that it wouldn't help me anyway as
    > I need to add a logo and sometimes adjust the contrast or colour, so that
    > would probably mean recompressing anyway Interesting subject never the
    > less


    Why not convert the image to a non compressed file format, such as TIFF
    or PICT, even the editor's own format (Photoshop has it's own file
    format for example). Ensure you start off the with minimal compression
    JPG file though.

    You can then edit and resize with minimal, or no, loss. Save as a JPG at
    the final stage.

    If you're making images for web pages, you need to keep size below
    640x480 anyway, and preferably keep the 4/3 ratio as well.

    --
    Andy Hewitt ** FAF#1, OSOS#5 - BMW K100RS 8v, Honda Concerto 16v
    Windows free zone (Mac G3)
    <http://homepage.ntlworld.com/ahewitt/index.htm> (last update 12.02)
     
    Andy Hewitt, Dec 7, 2003
    #3
  4. Bob & Anni

    Trev Guest

    "Bob & Anni" <> wrote in message
    news:TaDAb.18061$9.net...
    > Thinking about this, it's probably only possible to do a lossless

    resize to 1/2 1/4 1/8 1/16th etc
    > Just realised that it wouldn't help me anyway as I need to add a logo

    and sometimes adjust the contrast or colour, so that would
    > probably mean recompressing anyway
    > Interesting subject never the less
    > --

    I think you mean without too much of a loss. It is impossible to remove
    75% of the pixels with out a loss of 75%.
    On the other hand the jpeg compression of a 600 x 400 does not need to
    be high enough to cause bad artefacts when getting the file size down
     
    Trev, Dec 7, 2003
    #4
  5. "Bob & Anni" <> wrote in
    news:q3DAb.18057$9.net:

    > I know it's possible to do JPEG lossless rotation and cropping but is it
    > possible to do lossless re-sizing as well? Starting with large images
    > (pixel count) I use jpegcrop to crop to the required composition but
    > then I want to resize the resulting image to fit my web pages.


    Lossless downsizing is never possible, JPEG or not.

    Lossless upsizing is not possible with JPEG. JPEG is
    coded in 16x16 squares. Each such square is transformed
    from the spatial to the frequency plane and then the
    resulting frequency representation is compressed lossy.


    Roland
     
    Roland Karlsson, Dec 7, 2003
    #5
  6. > I know it's possible to do JPEG lossless rotation and cropping but is it
    possible to do lossless re-sizing as well?

    What does "lossless re-sizing" mean? Reducing the number of pixels while
    retaining the same number of pixels?
     
    Andrew Koenig, Dec 7, 2003
    #6
  7. Andrew Koenig wrote:

    >> I know it's possible to do JPEG lossless rotation and cropping
    >> but is it possible to do lossless re-sizing as well?

    >
    > What does "lossless re-sizing" mean? Reducing the number of
    > pixels while retaining the same number of pixels?


    Given that lossless cropping of JPEGs is also an oxymoron, but that
    most people understand the meaning (avoiding artefact introducing
    recompression), a bet would be that Bob & Anni wants to do the same
    for resized images.


    I wouldn't be too worried about the errors introduced by a complete
    recompression, if we're talking about resizing to a smaller image. The
    old JPEG artefacts would likely be rendered invisible by the resizing,
    so only new artefacts would be visible. Besides, for webuse I'd
    normally compress harder than for other use so a recompression would
    be worth considering even if it was possible to do without.
     
    Toke Eskildsen, Dec 7, 2003
    #7
  8. Bob & Anni

    Bob & Anni Guest

    At last, someone who understood what I meant by lossless - you pedantic lot :)
    I naturally thought everyone would understand that reducing the size in pixels would constitute an OBVIOUS "loss" but I was
    referring to artefacts and the overall effect this has on the overall quality.
    I'll try and be more precise next time, seems so many people are quick to jump in with smart comments.

    Thanks Andrew, yes as I said in my second post, it's probably not possible to do an arbitrary resizing without recompressing.
    I've always taken the jpegs from the camera (it only offers jpegs before anyone jumps in with a comment) and converted them to tiff
    before doing any work on them. Converting back to jpeg just prior to posting to the web.
    --
    Bob


    "Toke Eskildsen" <> wrote in message news:Xns944AADDE9DE88tokeeskildsen@130.133.1.4...
    > Andrew Koenig wrote:
    >
    > >> I know it's possible to do JPEG lossless rotation and cropping
    > >> but is it possible to do lossless re-sizing as well?

    > >
    > > What does "lossless re-sizing" mean? Reducing the number of
    > > pixels while retaining the same number of pixels?

    >
    > Given that lossless cropping of JPEGs is also an oxymoron, but that
    > most people understand the meaning (avoiding artefact introducing
    > recompression), a bet would be that Bob & Anni wants to do the same
    > for resized images.
    >
    >
    > I wouldn't be too worried about the errors introduced by a complete
    > recompression, if we're talking about resizing to a smaller image. The
    > old JPEG artefacts would likely be rendered invisible by the resizing,
    > so only new artefacts would be visible. Besides, for webuse I'd
    > normally compress harder than for other use so a recompression would
    > be worth considering even if it was possible to do without.
     
    Bob & Anni, Dec 7, 2003
    #8
  9. Bob & Anni

    Samuel Paik Guest

    Roland Karlsson <> wrote:
    > Lossless upsizing is not possible with JPEG. JPEG is
    > coded in 16x16 squares. Each such square is transformed
    > from the spatial to the frequency plane and then the
    > resulting frequency representation is compressed lossy.


    I'll have to think about the details, but power of two
    magnifications ought to be doable.

    Sam
     
    Samuel Paik, Dec 7, 2003
    #9
  10. Bob & Anni wrote:

    > At last, someone who understood what I meant by lossless - you pedantic lot :)
    > I naturally thought everyone would understand that reducing the size in pixels would constitute an OBVIOUS "loss" but I was
    > referring to artefacts and the overall effect this has on the overall quality.
    > I'll try and be more precise next time, seems so many people are quick to jump in with smart comments.
    >
    > Thanks Andrew, yes as I said in my second post, it's probably not possible to do an arbitrary resizing without recompressing.
    > I've always taken the jpegs from the camera (it only offers jpegs before anyone jumps in with a comment) and converted them to tiff
    > before doing any work on them. Converting back to jpeg just prior to posting to the web.
    > --
    > Bob


    Converting from a jpeg to tiff BEFORE working on an image buys you nothing.
    You can't INCREASE on the information content of the original jpeg.
    When you open a jpeg image in Photoshop, PS uncompresses the image to .psd format in much the same way that tiff would do. So you are
    always working on an uncompressed image file. Only when you SAVE the image does it make sense to convert to .tiff rather than .jpeg.
    SAVING in jpeg will apply another layer of compression on top of the original .jpeg degrading it somewhat . Having said that, however,
    I might add that you can SAVE in highest quality .jpeg compression quite a few times before the difference in quality is noticeable.
    Bob Williams
     
    Robert E. Williams, Dec 7, 2003
    #10
  11. Bob & Anni

    Bob & Anni Guest

    Thanks for clearing that up Robert, obviously I don't "convert" them as a separate job before working on them. I just do as you say,
    open them in an editing program and working on them before saving as tiff. Didn't think I would have to spell everything out, wish I
    hadn't started this now :-(
    I hope I didn't give the impression I was expecting to gain any information, that would be a stupid thing to expect.
    --
    Bob

    "Robert E. Williams" <> wrote in message news:...

    > Converting from a jpeg to tiff BEFORE working on an image buys you nothing.
    > You can't INCREASE on the information content of the original jpeg.
    > When you open a jpeg image in Photoshop, PS uncompresses the image to .psd format in much the same way that tiff would do. So you

    are
    > always working on an uncompressed image file. Only when you SAVE the image does it make sense to convert to .tiff rather than

    ..jpeg.
    > SAVING in jpeg will apply another layer of compression on top of the original .jpeg degrading it somewhat . Having said that,

    however,
    > I might add that you can SAVE in highest quality .jpeg compression quite a few times before the difference in quality is

    noticeable.
    > Bob Williams
    >
     
    Bob & Anni, Dec 7, 2003
    #11
  12. Bob & Anni

    Ron Hunter Guest

    Bob & Anni wrote:

    > I know it's possible to do JPEG lossless rotation and cropping but is it possible to do lossless re-sizing as well?
    > Starting with large images (pixel count) I use jpegcrop to crop to the required composition but then I want to resize the resulting
    > image to fit my web pages.


    I don't believe lossless cropping, as the image will need recompression.
    I would expect resizing to also require recompression. If that
    happens, some added loss will occur.
     
    Ron Hunter, Dec 7, 2003
    #12
  13. Ron Hunter <> wrote in news:vt7b6ir733bs98
    @corp.supernews.com:

    > I don't believe lossless cropping, as the image will need recompression.
    > I would expect resizing to also require recompression. If that
    > happens, some added loss will occur.
    >


    You can do lossless cropping - if you crop according to a 16x16 grid.


    Roland
     
    Roland Karlsson, Dec 7, 2003
    #13
  14. Bob & Anni

    Bob & Anni Guest

    Yes Ron, you can do cropping as long as you crop on the correct boundaries based on a 16x16 pixel grid.
    See this program jpegcrop.exe
    available at http://jpegclub.org/
    which got me thinking about resizing in the first place.
    Bob

    "Ron Hunter" <> wrote in message news:...

    > I don't believe lossless cropping, as the image will need recompression.
    > I would expect resizing to also require recompression. If that
    > happens, some added loss will occur.
     
    Bob & Anni, Dec 7, 2003
    #14
  15. Bob & Anni wrote:
    >
    > Thinking about this, it's probably only possible to do a lossless resize
    > to 1/2 1/4 1/8 1/16th etc


    A "lossless resize" with JPEG is not directly possible.
    However, if you use Jpegcrop with the zoom feature, you see that an optimal
    JPEG decompression to N/8 size with all N=1...16 is possible. But you
    would incur further loss if you would compress the result again to JPEG.

    Therefore I think that the best solution for the future would be to
    make JPEG decoders (and encoders) more flexible by supporting different
    spatial resolution output directly (see http://jpegclub.org/djpeg/ and
    http://jpegclub.org/cjpeg/), so you could avoid recompression when resizing.

    There is also a generalization of the method for arbitrary rescaling,
    but with more computational effort and not yet implemented. I will look
    into this later.

    > Just realised that it wouldn't help me anyway as I need to add a logo and
    > sometimes adjust the contrast or colour, so that would
    > probably mean recompressing anyway
    > Interesting subject never the less


    Regards
    Guido
     
    Guido Vollbeding, Dec 8, 2003
    #15
  16. (Samuel Paik) wrote in news:309a88d5.0312070949.a140ea7
    @posting.google.com:

    > I'll have to think about the details, but power of two
    > magnifications ought to be doable.


    I am quite sure that it is not possible.


    Roland
     
    Roland Karlsson, Dec 8, 2003
    #16
  17. Roland Karlsson wrote:
    >
    > (Samuel Paik) wrote in news:309a88d5.0312070949.a140ea7
    > @posting.google.com:
    >
    > > I'll have to think about the details, but power of two
    > > magnifications ought to be doable.

    >
    > I am quite sure that it is not possible.


    What you can do is compressing a spatial image to JPEG in such a way that
    it gets upsized by factor 4 or 8 and can be decoded *losslessly* to the
    original image, if using my new methods (see http://jpegclub.org/cjpeg/
    for more details).

    Regards
    Guido
     
    Guido Vollbeding, Dec 9, 2003
    #17
  18. Guido Vollbeding <> wrote in news:3FD59283.CE44F203
    @jpegclub.org:

    > What you can do is compressing a spatial image to JPEG in such a way that
    > it gets upsized by factor 4 or 8 and can be decoded *losslessly* to the
    > original image, if using my new methods (see http://jpegclub.org/cjpeg/
    > for more details).


    hehe ... sometimes someone implements the most strange things.
    Thx Guido for pointing this out. Looks like you have a fun time
    coding your djpeg/cjpeg thingies.


    Roland
     
    Roland Karlsson, Dec 9, 2003
    #18
  19. Roland Karlsson wrote:
    >
    > Guido Vollbeding <> wrote in news:3FD59283.CE44F203
    > @jpegclub.org:
    >
    > > What you can do is compressing a spatial image to JPEG in such a way that
    > > it gets upsized by factor 4 or 8 and can be decoded *losslessly* to the
    > > original image, if using my new methods (see http://jpegclub.org/cjpeg/
    > > for more details).

    >
    > hehe ... sometimes someone implements the most strange things.
    > Thx Guido for pointing this out. Looks like you have a fun time
    > coding your djpeg/cjpeg thingies.


    This comes from the fact that these new resizing features are based
    on the most important discovery about fundamental DCT properties
    since introduction of JPEG. You can read something about it in a
    paper I wrote for a conference recently: http://jpegclub.org/temp/

    Regards
    Guido
     
    Guido Vollbeding, Dec 10, 2003
    #19
    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. Jim Garrison

    ImageMagick and lossless JPEG rotation?

    Jim Garrison, Sep 30, 2003, in forum: Digital Photography
    Replies:
    8
    Views:
    11,554
    C0mdrData
    Oct 1, 2003
  2. nick c

    Re: JPEG 9 new lossless JPEG standard

    nick c, Jan 22, 2013, in forum: Digital Photography
    Replies:
    0
    Views:
    171
    nick c
    Jan 22, 2013
  3. David Dyer-Bennet

    Re: JPEG 9 new lossless JPEG standard

    David Dyer-Bennet, Jan 23, 2013, in forum: Digital Photography
    Replies:
    0
    Views:
    166
    David Dyer-Bennet
    Jan 23, 2013
  4. Martin Brown

    Re: JPEG 9 new lossless JPEG standard

    Martin Brown, Jan 23, 2013, in forum: Digital Photography
    Replies:
    16
    Views:
    501
    Wolfgang Weisselberg
    Feb 13, 2013
  5. Joe Kotroczo

    Re: JPEG 9 new lossless JPEG standard

    Joe Kotroczo, Jan 23, 2013, in forum: Digital Photography
    Replies:
    0
    Views:
    153
    Joe Kotroczo
    Jan 23, 2013
Loading...

Share This Page