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

YD
Posted By
yodel_dodel
Apr 2, 2007
Views
888
Replies
10
Status
Closed
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 image.

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?


Gregor mit dem Motorrad auf Reisen
http://hothaus.de/greg-tour/

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

R
Roberto
Apr 2, 2007
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)
YD
yodel_dodel
Apr 2, 2007
=(8) wrote:
I would be that is because JPG doesn’t allow for diferent quality settings in a single image.

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.


Gregor mit dem Motorrad auf Reisen
http://hothaus.de/greg-tour/
T
Tacit
Apr 3, 2007
In article <eur7b1$e1m$>, "Greg N."
wrote:

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.

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.


Photography, kink, polyamory, shareware, and more: all at http://www.xeromag.com/franklin.html
T
Tacit
Apr 3, 2007
In article <46113b74$0$14126$>,
"=\(8\)" wrote:

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%.

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.


Photography, kink, polyamory, shareware, and more: all at http://www.xeromag.com/franklin.html
R
Roberto
Apr 3, 2007
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 this.

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)
YD
yodel_dodel
Apr 3, 2007
tacit wrote:

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.

Are you sure? …

If you look at a file saved on disk, the size of that file on disk is rounded up…

Sure.

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.


Gregor mit dem Motorrad auf Reisen
http://hothaus.de/greg-tour/
YD
yodel_dodel
Apr 3, 2007
=(8) wrote:

So show me anything that says JPG can do what Adobe’s little gimmick suggests that it can do.

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.


Gregor mit dem Motorrad auf Reisen
http://hothaus.de/greg-tour/
TE
Toke Eskildsen
Apr 3, 2007
=(8) wrote:

If this was possible I would think you would see a lot more programs offer this.

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:

http://www.v-methods.com/ji/
http://www.xat.com/jpegopt/index.html
http://www.cyberviewcd.com/cvimage/index.html
http://www.cbtcafe.com/fireworks/selectivejpg/selectivejpg.h tml http://www.cooltoolawards.com/software/multimedia/jpgcompres sor.htm
Toke Eskildsen – http://ekot.dk/
DF
Derek Fountain
Apr 4, 2007
Greg N. wrote:
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 image.

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?

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 on the web at http://www.derekfountain.org/
YD
yodel_dodel
Apr 4, 2007
Derek Fountain wrote:

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%?

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).

You can probably see where this line of question is leading… 🙂

Sorry, not really.


Gregor mit dem Motorrad auf Reisen
http://hothaus.de/greg-tour/

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Related Discussion Topics

Nice and short text about related topics in discussion sections