Two different JPEG compression algorithms in Photoshop

OU
Posted By
Olaf_Ulrich
Sep 18, 2006
Views
893
Replies
19
Status
Closed
I wonder why there are (at least) two different JPEG compression algorithms implemented in Photoshop. The JPEG algorithm used for ‘Save’ and ‘Save As …’ (with JPG selected as the file type) is different from the algorithm used in the ‘Save For Web …’ command. When I do ‘Save For Web …’ I get smaller files at higher quality (= less JPEG compression artefacts). However, ‘Save For Web …’ strips EXIF and IPTC metadata so it’s useless for general work.

How can I use the (much better) ‘Save For Web …’ JPEG compression algorithm to save JPEG files *with* all their metadata? And why are the algorithms different in the first place?

— Olaf

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

CN
Cybernetic Nomad
Sep 18, 2006
Save for web strip metadata from the file, that’s why it’s smaller.

AFAIK, the JPEG compression is the same
CC
Chris_Cox
Sep 18, 2006
They are the same algorithm, and the same code — just different options (include metadata, include color profile, etc.).
CL
Christopher_L_Miller
Sep 18, 2006
I’ve wondered about this too. The save as options allow you to specify a quality from 0 to 12. In the save for web dialog, quality goes from 0 to 100. If they are the same algorithm, it would be nice if there were some consistency between the two.
CC
Chris_Cox
Sep 18, 2006
It’s just historical differences in the UI….
JJ
John Joslin
Sep 19, 2006
Save for web came from ImageReady.
OU
Olaf_Ulrich
Sep 21, 2006
"Cybernetic Nomad" wrote:

Save for web strip metadata from the file, that’s why it’s smaller.

That definitely is not the point … just how stupid do you think I am?

When I manually strip all metadata from the JPEG file created by ‘Save As …,’ tell Photoshop not to include a colour profile, and adjust the quality settings so that the two JPEG files are the same (within one kilobyte or so) then the JPEG file created by ‘Save For Web …’ always is *much* better (i. e. shows less compression artefacts).

The two JPEG compression algorithms definitely are not the same.

Why?

— Olaf
DM
Don_McCahill
Sep 21, 2006
The two JPEG compression algorithms definitely are not the same.

How do you know? Have you access to the code for Photoshop? Chris Cox does (his name is on the splash screen of your Photoshop as one of the engineers). In message 2 he tells us the code is the same.

Unless you have some evidence that they are different, I will tend to believe him.
P
progress
Sep 21, 2006
It’s just historical differences in the UI….

and they are there still because?
JO
Jim_Oblak
Sep 21, 2006
just how stupid do you think I am?

🙂

How do you manually strip all metadata in ‘Save As’? Look in a binary editor and see if you really have removed that data.
OU
Olaf_Ulrich
Sep 21, 2006
Don McCahill wrote:

How do you know? […] Unless you have some evidence that they are different, I will tend to believe him.

Simply have a look at the results. They *are* different.

Jim Oblak wrote:

How do you manually strip all metadata in ‘Save As’?

Using ‘Exifer.’

— Olaf
B
Bernie
Sep 21, 2006
Using ‘Exifer.’

Which may or may not (I really don’t know, never having used it) reencode the JPEG, thus causing additional degradation of the image
CL
Christopher_L_Miller
Sep 21, 2006
Well, since there is this historical difference in the UI, I suppose we’ll never know. Something about apples and oranges comes to mind… And there’s probably no point getting all worked up about it.

😛

Chris.
JO
Jim_Oblak
Sep 21, 2006
Olaf, I think you misunderstood my question:

Jim Oblak wrote:

How do you manually strip all metadata in ‘Save As’?

Olaf Ulrich wrote:

Using ‘Exifer.’

Exifer is not Photoshop – – So I ask ‘how do you manually strip all metadata in ‘Save As’ to compare with ‘Save for Web’?

If you use a hex editor, you can better compare the files prodused by these two options in Photoshop. The fact remains that ‘Save as’ includes excess data that ‘Save for Web’ does not include by default. Because one interface measures quality by percent and the other measures by values of 1-12, we are incapable of making a perfect comparison.

Save For Web …’ strips EXIF and IPTC metadata so it’s useless for general work.

How is this useless? This is exactly what you want for general work saved for the web.
GH
Gernot_Hoffmann
Sep 21, 2006
Olaf’s informations are IMO vague.

Two images, one compressed by Save for Web,
the other by Save As JPEG, with the same file
size, can be compared (concerning the quality)
only, if the file is sufficiently large.
As a rule of thumb:
Save for Web uses about 1kB for tables.
Save as JPEG uses about 4kB for tables and
metadata (not tested actually).
A comparison of the quality for the same file
size would require about 50kB, where 49kB or
46kB are used for the image content.

At least it’s safe to say that the comparison
would be wrong for final JPEGs with size 10kB.

Best regards –Gernot Hoffmann
CL
Christopher_L_Miller
Sep 21, 2006
My thoughts exactly. I’d be willing to bet that most people using "Save for Web" don’t want EXIF data. If I need that I use "Save As…" and a high quality setting.

This is an interesting discussion and I have nothing better to do right now. So…

I think it’s possible as Chris says, that the compression algorithm is exactly the same. But as we’ve agreed, the quality scale is different, and compressed data is not all that’s in a JPEG file.

It’s also possible that the zero mark on the quality scales is different between save for web and save as jpg. The zero quality mark must have been a judgement call on someone’s part, because a zero quality image is still recognizable in most cases. If you were to truly compress an image down to it’s absolute smallest size with zero regard for quality, you might very well end up with a rectangle of one solid color!

There are a ton of variables. I’m just happy that it works and I use it every day. If I ever need a tiny file with EXIF, I’ll probably find a piece of software to add it, or use something else to save it.
CC
Chris_Cox
Sep 21, 2006
Olaf – the code is the SAME. The only difference between files saved from Photoshop directly or from ImageReady/SaveForWeb is the metadata.
DM
Don_McCahill
Sep 21, 2006
Yeah, but what do you know, Chris.

🙂
CL
Christopher_L_Miller
Sep 21, 2006
Chris, just curious… Can you shed any light on the relationship between the quality settings in the two save functions? For example, is the zero quality setting different? Is the 100% (er… 12) setting different?
CC
Chris_Cox
Sep 21, 2006
I’m not sure of the mapping of the controls — I think they’re linearly scaled, but I’d have to go read the ImageReady/SFW code to be sure.

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

Related Discussion Topics

Nice and short text about related topics in discussion sections