Photoshop CC: JPEG file size.

  • 3
  • Problem
  • Updated 3 weeks ago
There seems to be a problem with compression/file size when saving jpeg images. A fresh save creates a bloated file size that can only be corrected by saving in a different format first (png) reloading that image, and then re-saving that to jpg format - this then removes significant memory from the final file size.
Photo of RB

RB

  • 1 Post
  • 0 Reply Likes

Posted 3 weeks ago

  • 3
Photo of Mark Payne

Mark Payne

  • 20 Posts
  • 2 Reply Likes
I tested this and did get a small file size difference on simple 2 color artwork.

A more complex full colored layered file resulted in the same file size after resaving.

This is something I have never tested, so I don't know if this is inherent and consistent behavior, and I don't know how the png format affects the file data.
Photo of Paul Searle

Paul Searle

  • 3 Posts
  • 0 Reply Likes
When I tested it the file size difference was actually quite large (In some occasions over 90% saving). Saving directly from a PSD would not go below 1mb even when saving as a '0' quality JPG.


This JPG has been saved straight from Photoshop as '0' quality. it's 942kb.

The other extreme is saving the image as a SuperPNG (http://www.fnordware.com/superpng/) without quantising it, opening the PNG file and then saving it as a JPG. This produces an identical result to the original:

 
As you can see there is zero visual difference except this file is 45kb.

Saving it as a Photoshop PNG produces a JPG that is somewhere nearer the original but lower than the original JPG

Metadata was my first thought however that cannot account for the massive size differences as SuperPNG should just be stripping that. unless Photoshop automatically bloats the files into oblivion.

I'm not sure as to what else could cause this.
Photo of Mark Payne

Mark Payne

  • 20 Posts
  • 2 Reply Likes
That does sound odd if at 0 quality, you cannot compress beyond 1MB.

I first tested a tiff file (I wasn't thinking, we are already using compressed files!), so I may try a psd file and see.

In any case, if saving as png first and then jpeg gives me a smaller file size - that would actually be useful here in some cases!
Photo of Johan Elzenga

Johan Elzenga, Champion

  • 1047 Posts
  • 401 Reply Likes
"I first tested a tiff file (I wasn't thinking, we are already using compressed files!), so I may try a psd file and see."

TIFF uses lossless compression (assuming you used LZW), so when the image is opened in Photoshop and decompressed, there is no difference with an image that never was compressed in the first place.
Photo of Mark Payne

Mark Payne

  • 20 Posts
  • 2 Reply Likes
There is no visual difference, but the TIFF files are usually a bit smaller. However, yes, resaving the tiff as PSD is no different.

Paul, I am struggling to find a filesize difference with the 2 methods (PSD to JPEG) vs (PSD to PNG to JPEG). At least with the available files I tested at the moment.

I realize that certain files compress better or worse than others, so I am wondering if there is something inherent in your files (or workflow) that prevents the compression under traditional methods.

Is this something that you have noticed recently after CC update, or perhaps you are working with larger files recently that are fuller with more tones?
Photo of Paul Searle

Paul Searle

  • 3 Posts
  • 0 Reply Likes
I have no specific workflow to replicate this. I create artwork usually by painting something, I save it as a PSD to store the layers. Once I want to save an image I'll "Save As > JPG > Quality 'X' (Which in this test case was zero)" This will in 99% of occasions not produce a file smaller than 900kb.

This is odd because that previous image saved as a standard Photoshop PNG (smallest file size, longest save time) produced a file size of 880kb. PNG's are lossless where as JPG's are lossy. 

There is no way the png should be smaller than the JPG.I know JPG's have issues with some colours but like I've mentioned this happens on most files regardless of colour, size or complexity.
Photo of Johan Elzenga

Johan Elzenga, Champion

  • 1047 Posts
  • 401 Reply Likes
I'm not an expert in compression, but your statement “there is no way the png should be smaller than the jpg” is not necessarily true. Yes, jpg is lossy compression, but the compression method is quite different. For a monochrome image like this one, it's perfectly possible that some lossless compression method is more effective than jpg. I have seen a carefully crafted 16 megapixel tiff, that contained all 16 million colors that are possible in an 8 bits file (so litterally each pixel was a different color). This tiff compressed to an incredible small size (a few hundred KB) thanks to the layout of the colors. A jpg version of the same file would have compressed very poorly, for the exact same reason.
Photo of Paul Searle

Paul Searle

  • 3 Posts
  • 0 Reply Likes
Digging deeper it could be something to do with the Metadata as the second one didn't have ICC Metadata or a Colour Profile, similar to that of a "Save for Web" JPG. I'm not sure why these options aren't placed into the standard "Save As JPG" dialog box.
Photo of Mark Payne

Mark Payne

  • 20 Posts
  • 2 Reply Likes
I looked at the ICC option and it did not make a difference here with regards to filesize on the JPEG at 0 quality. I agree that this option could/should also be in the last JPEG dialogue.

I do agree with Johan about the parsing of files that have millions of colors vs a file that has, say 256.
This is similar to the way audio files are compressed to MP3. The more similar the data in the file, the more it can "throw away" thus a smaller resulting filesize.

I actually did try one file that could not go below 2.1MB either way, but I still did not get a difference in file size from the different methods - because perhaps this particular file only has 7-8 basic colors (the anti aliasing is what is producing the tones.)

You may be able to set up a test by making one file true monochrome and seeing if it makes a difference in compression ratio vs a full multicolored file.

I am kinda curious myself!
Photo of Mark Payne

Mark Payne

  • 20 Posts
  • 2 Reply Likes
Paul - sorry, I missed the part where you mentioned already that this happens regardless of filesize, colour, etc.

I try to do some more tests later.