Albert25 wrote:also, if the image is already in RGB, is it correct to assume that "-colorspace RGB" will do nothing?
Yes.
Albert25 wrote:Is there always an embedded profile in AdobeRGB? If not, how can I find out if the image is sRGB or AdobeRGB?
Well, the profile
should be embedded (if it's not sRGB). And with AdobeRGB files, it almost always is, I would say.
Sometimes, profiles are not embedded and there is only a textual reference in the metadata (e.g. the Photoshop profile). So, if you want to be sure, use "identify -verbose" on the file (or even something like exiftool). If ImageMagick shows that an ICC profile is embedded, use that. If not and you discover a hint to the profile in the metadata, try to use that. (Of course you have to obtain the color profile from somewhere else in this case and you have to specify it manually at the commandline.)
But be careful as sometimes a 'hint' in the metadata is false or was not updated during earlier conversions of the file.
If there are false colors in the image or if there is no embedded color profile, and also no remark in the metadata, then it's the fault of the person that created/sent that file..
In some cases, e.g. when the image looks under-saturated, one is able to say: 'That might be AdobeRGB, I'll try to use that profile and see if it looks correct then.' But that can't be a general approach.
Albert25 wrote:Now what is the correct conversion?
I think, the documentation says it quite well. (OK, for me, when I started with color profiles, that topic was confusing for me as well.)
If the profile is embedded, just use a "convert
inputfile.jpg -profile
outputprofile.icc outputfile.jpg" command.
If it's not embedded, use a "convert
inputfile.jpg -profile
inputprofile.icc -profile
outputprofile.icc outputfile.jpg" command.
By the way: If I have a CMYK picture and there's no embedded profile, I typically use "US Web Coated SWOP" as input color profile.
If you're not sure about embedded color profiles, then add '-strip' (which should delete all metadata) or at least '+profile "icc,icm"' (which deletes 'only' the color profiles) after the inputfile - like that:
convert
inputfile.jpg -strip -profile
inputprofile.icc -profile
outputprofile.icc outputfile.jpg
This is to make sure that only the two specified color profiles are used (and not an additional color profile from the input image if it has one embedded).
Other orders of these options are sometimes possible, but the recommended order is to add these between your input and output image.
If you don't want to embed the output color profile into the output image, you can add another '-strip' (or the +profile variant) - after the conversion with the profiles. So, an example of a conversion of a CMYK image without embedded profile into a sRGB image (and no embedding of the sRGB profile) could look like this:
convert input.jpg -strip -profile USWebCoatedSWOP.icc -profile "sRGB Color Space Profile.icm" -strip output.jpg
Feel free to ask if something remains unclear.