Merging color profile into photo? (Save for web)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
harry_tasker
Posts: 3
Joined: 2015-05-15T22:04:47-07:00
Authentication code: 6789

Merging color profile into photo? (Save for web)

Post by harry_tasker »

I don't even know if that's the right phrasing but this is my problem:

1) I edited and saved a large number of photos in Photoshop using the "Save As" dialog instead of "Save for web".

2) Now when I upload to websites, the color profile is being stripped away and the images look terrible. (Desaturated)

Is there a way I can fix this using the command line? I would prefer not to open them all in Photoshop and go through a Save for web action!

Thanks!
Harry
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Merging color profile into photo? (Save for web)

Post by snibgo »

I suppose the problem is that the images are not encoded as sRGB. They contain an embedded profile that describes the encoding, but browsers ignore this.

The cure is to convert them to sRGB:

Code: Select all

convert in.ext -profile sRGB.icc -strip out.ext
Provide the path to sRGB.icc. You'll probably find a copy in the directory that contains "convert".

"-strip" removes the new embedded sRGB profile. Strictly speaking you shouldn't do this, but it saves filespace and hence bandwidth.
snibgo's IM pages: im.snibgo.com
harry_tasker
Posts: 3
Joined: 2015-05-15T22:04:47-07:00
Authentication code: 6789

Re: Merging color profile into photo? (Save for web)

Post by harry_tasker »

That makes sense and thanks for the quick reply.

I don't see any .icc files in the directory so I downloaded one from here:
http://www.color.org/srgbprofiles.xalter#v4app

It seems to have solved my issue! Is that the best color profile to be using?

Thanks!
Harry
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Merging color profile into photo? (Save for web)

Post by snibgo »

If you "-strip", then it doesn't matter which sRGB profile you use. If the result looks good, it is good.

When converting to sRGB, you should also consider the "-intent" setting before "-profile". For photos, "-intent perceptual" is usually best, and this is usually the default for the .icc file. More info at http://www.color.org/iccprofile.xalter

The reason why you technically shouldn't strip is that some browsers (and other viewing software) do take embedded profiles into account. For these, leaving the profile in the file will give the most accurate results to the user.

When I last experimented with profiles and browsers/viewers, I found that hardly any respected ICC v4 profiles. So my advice then was: if you don't strip, use v2 in preference to v4. I haven't repeated the experiments with recent software.
snibgo's IM pages: im.snibgo.com
harry_tasker
Posts: 3
Joined: 2015-05-15T22:04:47-07:00
Authentication code: 6789

Re: Merging color profile into photo? (Save for web)

Post by harry_tasker »

Thanks for all this information!
Post Reply