modify quality through alpha channel doesn't yield smaller file size

Discussion in 'Photoshop Tutorials' started by Greg N., Apr 2, 2007.

  1. Greg N.

    Greg N. Guest

    I'm experimenting with the "modify quality" function in "save for web"
    in CS2. I have created an alpha channel that is white where I want
    good image quality, and black where low quality is sufficient.

    Then, I set the quality slider to minimum:10%, maximum:30% and saved the

    It does what's expected: The specified parts are at medium quality, the
    rest of the image at low quality.

    But I don't get a smaller JPEG image file size: The file size of this
    image thus selectively set to quality 30% is no smaller than the file
    size I get if I save the entire image at quality 30.

    Is my expectation wrong? What is it I'm not getting here?
    Greg N., Apr 2, 2007
    1. Advertisements

  2. Greg N.

    =\(8\) Guest

    I would be that is because JPG doesn't allow for diferent quality settings
    in a single image. So what you are getting is so sort of Photoshop trick
    that makes it look like you are, but in the end you are getting the highest
    amount you set, in this case 30%.

    Photoshop could do things to the areas below 30% so that theoretically they
    would compress better but that is not the same as one area of the image
    getting a real 10% JPG compression and another part getting a real 20% and
    so on. You can increase how well an image compresses with JPG by bluring it.
    That is why Save For Web has a blur slider in it for JPG. The smoother the
    tones the better it will compress. So it could be what Photoshop is doing is
    apply different amounts of blur to the areas you selected with the alpha
    channel in the hopes that those areas will compress better. But, you are
    still compressing the entire image at 30% so I wouldn't expect a whole lot
    of difference.

    Try blurring your image by different amounts and see what kind of
    compression changes you get. I would bet that you won't see much and that is
    when you do the entire image, not varying the compression is a few areas.

    =\(8\), Apr 2, 2007
    1. Advertisements

  3. Greg N.

    Greg N. Guest

    Can you quote a source for that statement. I have great difficulty
    believing it.

    You know, the quality setting is nothing inherent to a jpg, it is
    something that matters only to the encoder. It basically says, into
    what level of detail the ENCODING process is supposed to go.

    The decoding mechanism knows nothing at all about quality settings. It
    just decodes whatever data is there, in other words, whatever detail was
    encoded in the image.

    Therefore, a JPG with varying levels of detail is certainly possible, it
    just takes an appropriately smart encoder. Again, the decoding process
    is entirely unaffected by that.

    At least, that's how I understand the mechanism.
    Greg N., Apr 2, 2007
  4. Greg N.

    tacit Guest

    Are you sure? What is the size of the image when saved with variable
    compression vs. with a single compression value, and where are you
    getting that information?

    If you look at a file saved on disk, the size of that file on disk is
    rounded up to the nearest "allocation block" size of your disk. A
    one-byte file on a computer disk does not take one byte of space,
    because space on the disk is allocated in chunks, typically chunks of 4K
    or so.
    tacit, Apr 3, 2007
  5. Greg N.

    tacit Guest

    JPEG odes allow for variable quality settings in a single image. Some
    parts of the JPEG are encoded with different quantization settings than
    others. Photoshop's Save for Web command allows you to use an alpha
    channel to specify different levels of compression for different parts
    of a JPEG.
    tacit, Apr 3, 2007
  6. Greg N.

    =\(8\) Guest

    As far an I know Adobe is the only company to offer Alpha Channel JPG
    compression. I ask you to show me something that says JPG format supports
    assigning different compression amounts to various parts of the same image?
    If this was possible I would think you would see a lot more programs offer

    JPG is an old format and honestly not a very good one by modern standards.
    It sticks around because no one has done anything better that they can get
    in to mass use. There have been other good formats but there has always been
    something stopping them. People didn't trust the creators, licensing issues,
    royalty issues, etc. Most companies aren't going to pay a royalty for a
    format that isn't in wide use. Really a catch 22.

    So show me anything that says JPG can do what Adobe's little gimmick
    suggests that it can do. The only thing JPG can do is block up and do better
    compression on areas of an image that have little detail, like a blue sky
    vs. a swatch of fabric. However, this is not the type of compression Adobe
    promises. The image still uses a single set compression, the fact that JPG
    works better with certain areas of the image doesn't mean that that area of
    the image is getting a 20% compression while the rest of the image is
    getting a 60% or in the terms of Photoshop this doesn't mean that one area
    is getting a compression setting of 10 and the rest is getting a compression
    setting of 2.

    =\(8\), Apr 3, 2007
  7. Greg N.

    Greg N. Guest


    I did some more testing.

    The selective quality mechanism, at medium quality settings, does not
    significantly affect file size at all. At high quality settings,
    there are some minor savings. My test file, encoded at 90%, is 106K.
    At variable compression 50%-90%, it goes down to 95K. Only about 15% of
    the picture's real estate are set to encode at high quality.

    The overall image quality at 50-90% variable compression, though, is
    very noticeably inferior to straight 90%.

    In short, the whole mechanism, as implemented in CS2 right now, is not
    worth the trouble, in my opinion.
    Greg N., Apr 3, 2007
  8. Greg N.

    Greg N. Guest

    If you understand how JPG encoding works, it should be very obvious that
    this is doable, because the JPG structure clearly allows for it.

    JPG, like, for instance, MP3, is a specification that only defines how
    data is decoded. It's up to the programmer how smart an encoder he can
    come up with.

    On the other hand, the current implementation in CS2 is certainly not
    worth the trouble.
    Greg N., Apr 3, 2007
  9. Why? It something that takes a fair amount of fiddling, with not that
    much payoff in file size. It's only something one would do is there was
    very hard requirements on bandwidth or storage space.

    But since you ask... 2 minutes with Google gave these:
    Toke Eskildsen, Apr 3, 2007
  10. Questions:

    If you save the whole image at 10% what is the file size? If you save
    the whole image at 30%, what is the file size? Roughly what percentage
    of the image does your mask make 10% and what percentage does it make 30%?

    You can probably see where this line of question is leading... :)
    Derek Fountain, Apr 4, 2007
  11. Greg N.

    Greg N. Guest

    At quality 10%, the file size is 10.9 K
    At quality 30%, the file size is 18.6 K
    At quality 10%-30%, file size is 19.4 K
    In the alpha channel, about 15% of the image is white (high quality).
    Sorry, not really.
    Greg N., Apr 4, 2007
    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.