Why does photoshop reduce my file size after I make changes?

Facts are facts.
If you slide the quality slider to 100% guess what is happening? There is an algorithm being applied that does NOTHING. That is why you are finding out that your file size is larger with no difference. There is a second layer of compression embedded into the file that ends up beefing up the size without changing the file.

This is the difference between professional software and freeware. Photoshop would never allow this because it is completely useless, potentially harms the image, and in the end will increase file size. Also do note that "max" on photoshop jpeg compression appears to be 10, but actually is 12.
Finally some interesting response. However, I fail to understand one thing - you're saying, that nothing happens, adding some second layer in the same time that is invisible and useless, while there's no change in the file, no pixels altered, yet you claim, that it is potentially dangerous? How's that?

GooniesNeverSayDie11 said:
I should add, that I am not seriously trying to insult your or anything, although the "IT" comment did come off a little snobbish. Just busting your stones a little. ( not sure if that term translates well to Slovakia )
That IT thing I've mentioned was because I don't need lectures on what "lossy" means, nor about file types. Nothing snobbish meant by this, but I understand it maybe didn't leave the right impression. Sorry about that ;)
 
Even at the highest setting, 12, there is some file compression. Certainly there is considerably more compression at the lowest setting of 0.

Ok, I played with it some more last night, and this was my problem. PS defaults to setting 10, I didn't notice it went up to 12. If I set it at 12 and do the pass mode 5 layers (not really sure what that is), it actually slightly increases the file size.

Thanks again for the info and the debate. And thanks mod for not locking this thread prematurely!
Scott
 
What I explained is completely correct, there is much more detail than what I stated but what I stated is true. My lecture notes take about 30 minutes to go through, and it is not something I look forward to typing out to an audience that will not understand a vast majority of it.

Jpg is math. Math takes work. Work adds file size.

[ JPEG ] - this jpg compression takes up 1mb to be applied to an image, but it drops a 10mb file down to 200kb.
[ JPEG ] - This is the same compression. It still takes up 1mb. The computer must still run it. This also drops a 10mb file down to 200kb, however since there is an already existing jpeg compression it just takes what the previous one does and repeats it.

The file is now 2mb and 200kb instead of just being 1mb and 200 kb.

Another way to visual this:

{Jpeg [ File ] }
{Jpeg {Jpeg [ File ] }}

Which is bigger :D? If you answered the bottom one, you're right! Congrats.

So to recap, 1+1 = 2.
2 > 1.
Therefore, the more you add, the more you have! :D I'm so glad we had this discussion. Thanks :3

And I am so glad you were willing to take the time, given so many of us have a limited capacity to understand. I just hope you'll be willing to do one more thing and explain why an empirical test of what you've described fails to produce the expected result.

I opened a TIFF file in Photoshop. The original came from a RAW file and had never before been compressed.

I sized the photo to 2048 pixels wide and saved it as a JPEG with Photoshop's quality slider set to 12 (max).

I named the file jpeg_test1.jpg. Thanks to you I now know I have {Jpeg [ File ] } and the file size is 2,076,337. See for yourself:

jpg_1.jpg



I opened up the file jpeg_test1.jpg in Photoshop and saved it with a different name using the File SaveAs operation. I created jpeg_test2.jpg (JPEG slider still at 12). According to you I now have {Jpeg {Jpeg [ File ] }} and therefore my jpeg_test2.jpg file must be bloated by a second JPEG and since the previous JPEG was already there the math just repeated itself. And that explains why my second file is larger by a negative 44,945 bytes. See for yourself:

jpg_2.jpg



I don't think this is true: -44,945 > 0. Could you have missed something in those notes?

Joe
 
This is a close up of the bellow:
screenshot20110922at953.png



Here is the full file so you can see that the one on the left is created first, then the one on the right.
screenshot20110922at959.png


Yeah the second file looks smaller to me alright... all 6,949 bites larger. Opened photo... saved as jpeg... saved jpeg as jpeg... ended up slightly larger. Just like I said it would.

I have no clue what you're doing, but if you open a jpeg and save it as jpeg with identical settings (if you drop the quality at all, it will get smaller. Even if opened by a different application as not all programs save jpegs the same way), the new jpeg will be LARGER than the old one. I can do these examples all day long on hundreds of machines... anytime you stack compression you risk quality and gain size. (The risk of quality loss comes from opening several jpeg compressions) This is not coming from me, this is accepted industry knowledge. Go ask any graphic designer, video editor, or audio tech.

If you still doubt me I could show you a video of how this happens.

Edit**
Also since you are seeing that large of a drop off that is telling me you compressed the file further. A 44k drop is steep, if your compression worked fully it can never get smaller on the same settings. Again go search on your own, I'm not making this up. If you knew anything about how compression works then you would understand how you can't possibly be right.
 
Last edited:
...anytime you stack compression you lose quality and gain size.

Not according to you! And I quote you:

"There is an algorithm being applied that does NOTHING."

Losing quality isn't NOTHING it's something.

And I quote you:

"...however since there is an already existing jpeg compression it just takes what the previous one does and repeats it."

Losing quality is not repetition. If you repeat something it's the same.

Joe
 
Facts are facts.
If you slide the quality slider to 100% guess what is happening? There is an algorithm being applied that does NOTHING. That is why you are finding out that your file size is larger with no difference. There is a second layer of compression embedded into the file that ends up beefing up the size without changing the file.

This is the difference between professional software and freeware. Photoshop would never allow this because it is completely useless, potentially harms the image, and in the end will increase file size. Also do note that "max" on photoshop jpeg compression appears to be 10, but actually is 12.
Finally some interesting response. However, I fail to understand one thing - you're saying, that nothing happens, adding some second layer in the same time that is invisible and useless, while there's no change in the file, no pixels altered, yet you claim, that it is potentially dangerous? How's that?

GooniesNeverSayDie11 said:
I should add, that I am not seriously trying to insult your or anything, although the "IT" comment did come off a little snobbish. Just busting your stones a little. ( not sure if that term translates well to Slovakia )
That IT thing I've mentioned was because I don't need lectures on what "lossy" means, nor about file types. Nothing snobbish meant by this, but I understand it maybe didn't leave the right impression. Sorry about that ;)

The danger of it comes from repetition. If our computers were made by flawless machines then I'd say there is no risk, just larger file sizes. The fact is though ghosting happens. (Ghosting is where code does not always behave the same way every time).

Imagine this:
You are asked to paint a picture.
Now you are asked to paint the same picture again, identical to the first that will replace the first so it must be identical. Pretty difficult isn't it?

Granted people have a much harder time doing this than machines, which are created for the purpose of repetitive tasks.
Machines are great at repeating themselves, but like us they are not always perfect. Ghosting occurs in code that makes it behave differently then planned. So if you have a Jpeg { Jpeg [ File ] } Sandwich, what inevitably happens is artifacting that was not present originally. This doesn't have to happen, but it may. hence the "risk" of multiple compressions. Honestly will an amateur even notice? No way, I'd be amazed if anyone without a trained eye could take notice. So it isn't the end of the world, just a "best practice" sort of mindset.

Artifacts in jpegs can be anything from banding, to a pixel becoming the wrong color, to entire color shifts.

I do apologize as I was speaking out of term as photoshop allows you to re-apply jpeg compression as many times as you want. When I said "This is the difference between professional software and freeware..." I started saying one thing, and ended another. What I was trying to say is that programs like photoshop offer high quality compression that will not make you want to re-apply compression because in doing so does not increase quality but put it at risk. What I did say however couldn't be further from the truth as you can save files over and over again to stack multiple jpeg compressions (but again this just bloats the file as once compression is applied if no settings are changed it will always get larger.)

The increased file size comes from adding a second operation onto what should have only been one. The potential quality loss comes from the decompressor doing 2x the work.
I think what is hard to understand is what compression actually does. It is a mathematical formula that shrinks an image by a random but constant (for that image) factor. Once neatly grouped up into pixel quads, the compressor should always compress the image the same way time and time again. Thus never shrinking the file.

I got another good example! Just thought of it now :) Ok. Stay with me on this one, it may be a bit of a jump but I think it works:

Think of a compressor as a puzzle maker! It takes the file and makes it into a puzzle that must be re-assembled by another program at a later time. Say a quality 12 compression breaks an image into 100 puzzle pieces. If you add another quality 12 compression, it pretends like there was no previous compression so it starts with the full picture again and re-compresses the same exact way. Just like a puzzle is unique and can only be assembled one way. This is where the risk is involved, because if there is one miscalculation in the decimal places it can make a wide variety of artifact appear.
 
...anytime you stack compression you lose quality and gain size.

Not according to you! And I quote you:

"There is an algorithm being applied that does NOTHING."

Losing quality isn't NOTHING it's something.

And I quote you:

"...however since there is an already existing jpeg compression it just takes what the previous one does and repeats it."

Losing quality is not repetition. If you repeat something it's the same.

Joe

Repetition is not perfect, not even on computers. Try to nit-pick me all day, it doesn't matter; I know I'm right lol. You do risk losing quality, but the risk is extremely negligible. As a professional I would never put a client's work at risk like that, but for an amateur? The risk is so tiny it would be fruitless to worry about the artifacts that could occur, instead it would be better to just not make the mistake of double-compressing in the first place.

Please research more about your subject material before trying to attack someone that actually has an understanding of the subject. I don't mind defending my posts, and I do admit I make mistakes quite often. I couldn't be farther from perfect. Depending on the level of the people I'm speaking to I alter the material, if someone is struggling with a concept I'm not going to come at them with "When you stack compression, you gain size and run the risk of causing ghosting that can lead to an error in the de-compressor which causes an artifact in your jpeg, thus lowering its quality."

No, instead I'm going to explain it on their level.

The de-compressor must open every jpeg compression, so you're absolutely right it; adding a second compression doesn't do "nothing." You're just taking my words out of context, my use of the word "nothing" was intended as "The second compression does not compress the file more." Hence "There is an algorithm being applied that does NOTHING."

The secondary algorithm does not compress it further, it just repeats what the first did. Giving the computer a second chance to mess up an already difficult procedure. Jpeg may be a wonderfully fast loading file, but keep in mind that all compression is difficult and offers many opportunities for a computer to make a mistake.
 
Last edited:
...anytime you stack compression you lose quality and gain size.

Quick question, could someone explain what stack compression is? I think there is this option when I save, with a value of 1 through 5.

When I save in PS on 12 and click stack compression at 5, my file size does get larger. Is stack compression good or no? Is there a time to use this?
 
...anytime you stack compression you lose quality and gain size.

Quick question, could someone explain what stack compression is? I think there is this option when I save, with a value of 1 through 5.

When I save in PS on 12 and click stack compression at 5, my file size does get larger. Is stack compression good or no? Is there a time to use this?

I believe you are referring to progressive scan - 5?

The way this format works is the following:
There are 5 scans of the jpeg in one file. These range from poor quality, to full quality. The use for this is that when you view it you get an immediate result, of terrible quality. The longer you wait the better the quality becomes. Each scan of the 5, builds upon the previous versions. So the first scan is aweful but also very tiny. The final scan is your quality setting.

It gets bigger because you are choosing 5 (3 is probably all you would want for most files) then also putting the quality allllll the way up. Generally with this type of compression the end goal is web. It allows them to see an immediate result, then slowly increase the quality as the page loads. This is a web setting, more than a "keep it on my computer" setting. This type really shines (in my opinion) with 3 scans at a quality of 8.

Your size is most likely increasing because you are working with a jpeg file, then saving as a higher quality jpeg. As stated previously by KmH if you save a file in photoshop that is identical to the start, little compression if any is used so instead of shrinking the file; it expands.

The compression itself is comparable to the size of baseline jpeg - I don't want you to think that there are 5 jpegs in one file, just that by setting it to 5 there is more of a "squish" effect going on. This type of jpeg has not seen much use until recently with the web.
 
Last edited:
The danger of it comes from repetition. If our computers were made by flawless machines then I'd say there is no risk, just larger file sizes. The fact is though ghosting happens. (Ghosting is where code does not always behave the same way every time).

Imagine this:
You are asked to paint a picture.
Now you are asked to paint the same picture again, identical to the first that will replace the first so it must be identical. Pretty difficult isn't it?

Granted people have a much harder time doing this than machines, which are created for the purpose of repetitive tasks.
Machines are great at repeating themselves, but like us they are not always perfect. Ghosting occurs in code that makes it behave differently then planned. So if you have a Jpeg { Jpeg [ File ] } Sandwich, what inevitably happens is artifacting that was not present originally. This doesn't have to happen, but it may. hence the "risk" of multiple compressions. Honestly will an amateur even notice? No way, I'd be amazed if anyone without a trained eye could take notice. So it isn't the end of the world, just a "best practice" sort of mindset.

Artifacts in jpegs can be anything from banding, to a pixel becoming the wrong color, to entire color shifts.

I do apologize as I was speaking out of term as photoshop allows you to re-apply jpeg compression as many times as you want. When I said "This is the difference between professional software and freeware..." I started saying one thing, and ended another. What I was trying to say is that programs like photoshop offer high quality compression that will not make you want to re-apply compression because in doing so does not increase quality but put it at risk. What I did say however couldn't be further from the truth as you can save files over and over again to stack multiple jpeg compressions (but again this just bloats the file as once compression is applied if no settings are changed it will always get larger.)

The increased file size comes from adding a second operation onto what should have only been one. The potential quality loss comes from the decompressor doing 2x the work.
I think what is hard to understand is what compression actually does. It is a mathematical formula that shrinks an image by a random but constant (for that image) factor. Once neatly grouped up into pixel quads, the compressor should always compress the image the same way time and time again. Thus never shrinking the file.

I got another good example! Just thought of it now :) Ok. Stay with me on this one, it may be a bit of a jump but I think it works:

Think of a compressor as a puzzle maker! It takes the file and makes it into a puzzle that must be re-assembled by another program at a later time. Say a quality 12 compression breaks an image into 100 puzzle pieces. If you add another quality 12 compression, it pretends like there was no previous compression so it starts with the full picture again and re-compresses the same exact way. Just like a puzzle is unique and can only be assembled one way. This is where the risk is involved, because if there is one miscalculation in the decimal places it can make a wide variety of artifact appear.
Thank you for your time.
 
That example is a little off actually, with the puzzle at the end. I'm just having trouble relating it to something real and tangible. I'm unsure if the second compression ignores the first, or works with it. However from what I've seen with all types of compression is that if you apply identical compression it enlarges, which I must assume is because it is just repeating what the first already figured out.
 
It's interesting that Photoshop seems to increase the file size on the image after each save... in my testing of CS5... with no edits... it adds about 4K per save. However, I'm not sure that this is really the point, nor do I believe it is anything of any noteworthy consequence other than a virtual stick you can use to beat down anyone who might suggest otherwise.

First off, what does the file size mean?

It means only one thing: the file is bigger. For all we know, Photoshop could be storing some additional padding as part of their compression algorithm, or it is making a different decision here or there that is just winding up with a slightly different file size. This is not unheard of in compression.

Second, keep in mind what the compression alg is doing here. This isn't ZIP, and these aren't word documents. This is an image. There is a LOT of leeway afforded to an algorithm that is able to toss stuff in the trash without us knowing, and that's exactly what it is able to do. Toss a few bytes out in a word document and it may not work... or at best it's going to have some missing letters. Toss out a few bytes of visible data out from an image, and you may get a variation in a color of a pixel here and there. Almost nobody is going to notice that. However, do it enough times... and you might start to notice.


The thing that irks me about this entire conversation is you have several experienced people on here who are telling you that JPEG quality is lost in each new save, and some of you are whipping out the growing file size as some sort of ridiculous straw man to show how amazingly wrong we are.

Fine, let's dance.

Here is what I did...

I took one of my images and took a 100% crop image of the image and saved it at max quality in Photoshop CS4 64 bit.(level 12). I then opened each progressive saved copy of the file and then saved it with an incremented number. I did this 20 times.

As you can see, the file sizes did increase with each save.

file sizes.jpg


Here is the FIRST save of the file.

JPEG Test 2 Save 1.jpg


Here is the TWENTIETH save of the file.

JPEG Test 2 Save 20.jpg


Now it's a little hard to tell here, but what I recommend is that you save these off to your desktop and then open them both in an image viewer and flip back and forth between them. If you watch, you'll notice something. In some places in the image... the image CHANGED.

I highlighted a couple of the general areas here in this image so you can know where to look if you didn't happen to catch it.

JPEG Test 2 Save 20 couple areas marked.jpg


Now, are those changes earth shattering? Well... not overly... but they are changes, and that is the key bit. Every time you save off that file you risk a different re-interpretation of your image, which can have impacts on the quality of your image.

Period.
 
I believe you are referring to progressive scan - 5?

The way this format works is the following:
There are 5 scans of the jpeg in one file. These range from poor quality, to full quality. The use for this is that when you view it you get an immediate result, of terrible quality. The longer you wait the better the quality becomes. Each scan of the 5, builds upon the previous versions. So the first scan is aweful but also very tiny. The final scan is your quality setting.

It gets bigger because you are choosing 5 (3 is probably all you would want for most files) then also putting the quality allllll the way up. Generally with this type of compression the end goal is web. It allows them to see an immediate result, then slowly increase the quality as the page loads. This is a web setting, more than a "keep it on my computer" setting. This type really shines (in my opinion) with 3 scans at a quality of 8.

Your size is most likely increasing because you are working with a jpeg file, then saving as a higher quality jpeg. As stated previously by KmH if you save a file in photoshop that is identical to the start, little compression if any is used so instead of shrinking the file; it expands.

The compression itself is comparable to the size of baseline jpeg - I don't want you to think that there are 5 jpegs in one file, just that by setting it to 5 there is more of a "squish" effect going on. This type of jpeg has not seen much use until recently with the web.

Thanks so much for the info, makes sense...
 
That example is a little off actually, with the puzzle at the end. I'm just having trouble relating it to something real and tangible. I'm unsure if the second compression ignores the first, or works with it. However from what I've seen with all types of compression is that if you apply identical compression it enlarges, which I must assume is because it is just repeating what the first already figured out.

Now we're making some progress. You "must assume" is a lot better than dictating facts. I reacted to your first post and so as not to take you out of context:

"Facts are facts.

Jpegs are lossy. Period. There is no argument about this.
If you have any understanding of how file compression works then you would not be trying to argue this fact. Let me explain since there is a clear misunderstanding going on.

If you slide the quality slider to 100% guess what is happening? There is an algorithm being applied that does NOTHING. That is why you are finding out that your file size is larger with no difference. There is a second layer of compression embedded into the file that ends up beefing up the size without changing the file.

This is the difference between professional software and freeware. Photoshop would never allow this because it is completely useless, potentially harms the image, and in the end will increase file size. Also do note that "max" on photoshop jpeg compression appears to be 10, but actually is 12.

Saving a jpg, as jpg is very hazardous to your file's health and may cause banding as well as artifacting.

Again this is not opinion, this is fact. If you have questions about compression please consult google about compression, there are very lengthy articles I am sure. My knowledge comes from my teacher in college who helped develop algorithms for compression. I trust his explanation of how things work quite a bit"

And yes you did say the algorithm did NOTHING and you reinforced that by saying it didn't change the file. And we know that's wrong and yet we can understand what you actually meant (but didn't say).

I reacted to the arrogance and nonsense of your first post with sarcasm. I shouldn't have and I'm sorry.

In the example that I posted where the file shrank I used Photoshop CS4 and I most certainly did not alter the JPEG settings in any way. I did make a slight (visually imperceptible to most people) change in the file. I opened the Hue/Saturation dialog and lowered the saturation from 0 to -2 because that's what this whole thread was about!

And yes that was enough of a change to cause Photoshop to re-do the compression and shrink the file.

It is complete nonsense to open a file and re-save it without first altering it. Why would anyone ever want to do that? That's just dumb. This thread was about "Why does photoshop reduce my file size after I make changes?"

And the JPEG algorithm does do that. If you make even slight changes to the file content the JPEG algorithm will re-process the file.

You must have assumed people thought that compression applied to a compressed file would further compress the file. That wasn't what this thread was about.

You jumped in and dictated as gospel truth what would happen if someone did something that is utterly dumb and completely useless. Now you're "assuming" and it looks like manaheim has demonstrated that you're wrong.

Sorry for the sarcasm. I have to run to class now -- and how about that, it's a class in Photoshop.

Joe
 
Here is what I did...

I took one of my images and took a 100% crop image of the image and saved it at max quality in Photoshop CS4 64 bit.(level 12). I then opened each progressive saved copy of the file and then saved it with an incremented number. I did this 20 times.......

Now, are those changes earth shattering? Well... not overly... but they are changes, and that is the key bit. Every time you save off that file you risk a different re-interpretation of your image, which can have impacts on the quality of your image.

Period.

Nice job with the example.

This whole thing got somewhat out of hand and I'm guilty because I reacted poorly to shmne's first post. I think we all really pretty much agree and understand.

1. JPEG is a compression methodology that alters your file content and as such does damage.
2. You can't compress compressed. I think this is what shmne tried to say. If you re-apply JPEG level 10 compression to JPEG level 10 compression you're not going to get more compression.
3. Alter a file (Levels change, color change, etc.) and JPEG will re-process the file and that re-processing will do additional harm.
4. JPEG can never improve a photo. JPEG can only remove content and/or add noise (artifacts).
5. As you've shown, iterative JPEG without editing in between does alter the file and does do further damage. I believe shmne is fundamentally correct in this regard; slight variation in the run of the algorithm is at fault. I would assume over time the process is entropic.

Now I really have to run to class.

Joe
 

Most reactions

Back
Top