Sepia-Tone makes image blue
Sepia-Tone makes image blue
If i use the sepia filter on the following image:
http://ops42.ms-visucom.de/temp/heart_test_cmyk.jpg
while using the following command:
convert heart_test_cmyk.jpg -sepia-tone 80% heart_test_cmyk_sepia.jpg
the resulting image gets a blue tone:
http://ops42.ms-visucom.de/temp/heart_t ... _sepia.jpg
Instead of the expected sepia one. This does not happen, if the image is converted to rgb before. Only some specific image content seems to bring up the bug. Many ImageMagick versions on different servers seem to behave like this. In the example above, the following was used:
Version: ImageMagick 6.7.8-7 2012-08-06 Q16 http://www.imagemagick.org
http://ops42.ms-visucom.de/temp/heart_test_cmyk.jpg
while using the following command:
convert heart_test_cmyk.jpg -sepia-tone 80% heart_test_cmyk_sepia.jpg
the resulting image gets a blue tone:
http://ops42.ms-visucom.de/temp/heart_t ... _sepia.jpg
Instead of the expected sepia one. This does not happen, if the image is converted to rgb before. Only some specific image content seems to bring up the bug. Many ImageMagick versions on different servers seem to behave like this. In the example above, the following was used:
Version: ImageMagick 6.7.8-7 2012-08-06 Q16 http://www.imagemagick.org
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sepia-Tone makes image blue
Many of the effect filters (and colours in general) assume the input is sRGB, so you should convert to sRGB first.
Your version is very old, so you might want to upgrade sometime. But it won't affect this issue.
Your version is very old, so you might want to upgrade sometime. But it won't affect this issue.
snibgo's IM pages: im.snibgo.com
Re: Sepia-Tone makes image blue
Thanks for your explanation! My thought always was, to convert colorspaces only if needed. In this case, we just want to print a given cmyk image - just with that sepia-tone applied. But if understand correctly, there is no other choice but converting to srgb before to get reasonable results. That is (imho) kind of sad, as i do more modifications to the image than needed. Even more, i have to check if the cmyk-image has an cymk-profile and reuse that:
1. Check / save for cmyk profile
2. Convert to srgb
4. Apply the filter
5. Convert to cmyk (using the prior saved profile)
Right? Is there no option inside ImageMagick to do this automatically for processings that need theses steps either?
Is there an overview of processing options that assume/need sRGB?
1. Check / save for cmyk profile
2. Convert to srgb
4. Apply the filter
5. Convert to cmyk (using the prior saved profile)
Right? Is there no option inside ImageMagick to do this automatically for processings that need theses steps either?
Is there an overview of processing options that assume/need sRGB?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Sepia-Tone makes image blue
Right? Is there no option inside ImageMagick to do this automatically for processings that need theses steps either?
Is there an overview of processing options that assume/need sRGB?
As I understand things, most of IM color modification assumes sRGB (or grayscale). CMYK needs to be converted to sRGB before most processing. But I know of no list that says which ones do not assume that.
Though not as good, you could always use
Code: Select all
convert image -strip -colorspace sRGB some processing -colorspace CMYK result
I think you need to write a script to do your suggested processing outline as the best way to proceed.
Perhaps someone else can suggest a better approach or a list that identifies which processing is not dependent upon sRGB colorspace.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sepia-Tone makes image blue
If the colour profile is icc, you can extract it with "convert in.jpg temp.icc", then apply an sRGB profile, do your processing, and convert back to the saved profile. For example:
Pretty much all IM operations assume the channels represent RGB, and low values are dark and high values are light. They still work with CMYK, but everything is reversed. For example, "-fill red colorize 100" will turn RGB images red, but turns your image cyan. (This is because "Red" is merely a synonym for 100% in the first channel and 0 in the rest.) "+level 80,100%" will reduce contrast, putting all values between 80 and 100%. For RGB, this will lighten the image, but it darkens yours.
I expect processing could be designed to apply a sepia effect to CMYK directly, without going via sRGB. You could experiment with operations like "-tint".
I don't know if you converted to JPG for convenience of downloads. As a general rule, doing any processing on JPG is bad news, as there are only 8 bits/channel/pixel, and processing quickly produces artifacts such as banding.
Code: Select all
convert heart_test_cmyk.jpg +write temp.icc -profile sRGB.icc -sepia-tone 80% -profile temp.icc r.jpg
Pretty much all IM operations assume the channels represent RGB, and low values are dark and high values are light. They still work with CMYK, but everything is reversed. For example, "-fill red colorize 100" will turn RGB images red, but turns your image cyan. (This is because "Red" is merely a synonym for 100% in the first channel and 0 in the rest.) "+level 80,100%" will reduce contrast, putting all values between 80 and 100%. For RGB, this will lighten the image, but it darkens yours.
I expect processing could be designed to apply a sepia effect to CMYK directly, without going via sRGB. You could experiment with operations like "-tint".
I don't know if you converted to JPG for convenience of downloads. As a general rule, doing any processing on JPG is bad news, as there are only 8 bits/channel/pixel, and processing quickly produces artifacts such as banding.
snibgo's IM pages: im.snibgo.com
Re: Sepia-Tone makes image blue
I still dont get why ImageMagick has no automatics for converting to sRGB and back if needed. So i will have to implement that by myself.
Thanks for your enlightening answers!
Thanks for your enlightening answers!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sepia-Tone makes image blue
ImageMagick needs to be told when to convert between colorspaces, and which method you want to use and, if you are using profiles, what profile and where it is located.
ImageMagick is a powerful set of tools from which you can build systems like Instagram. If you prefer a fully-automated system like Instagram, get Instagram.
ImageMagick is a powerful set of tools from which you can build systems like Instagram. If you prefer a fully-automated system like Instagram, get Instagram.
snibgo's IM pages: im.snibgo.com
Re: Sepia-Tone makes image blue
You got me wrong. I was not thinking about a full "do everything automatic for me" functionality. But if in fact, many filters seem rely on srgb. It would be quite convinient (and possible, or not?!) to let ImageMagick do the neccessary conversions by itself?
Or at least, bring up a sensible warning like "Warning! The filter used produces unpredictable results in your current colorspace. Please convert to sRGB before!"
The current behaviour is a bad pitfall, IMHO.
BTW: Concerning your advice: does instagram indeed produce printable cmyks considering given icc-profiles?!
Or at least, bring up a sensible warning like "Warning! The filter used produces unpredictable results in your current colorspace. Please convert to sRGB before!"
The current behaviour is a bad pitfall, IMHO.
BTW: Concerning your advice: does instagram indeed produce printable cmyks considering given icc-profiles?!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sepia-Tone makes image blue
No. Many filters assume the channels represent red, green and blue, but not that the colorspace is sRGB.But if in fact, many filters seem rely on srgb.
snibgo's IM pages: im.snibgo.com
Re: Sepia-Tone makes image blue
I am confused:
by snibgo » 2015-11-16T18:36:28+01:00:
> Many of the effect filters (and colours in general) assume the input is sRGB, so you should convert to sRGB first.
by snibgo » 2015-11-18T19:48:40+01:00:
> No. Many filters assume the channels represent red, green and blue, but not that the colorspace is sRGB.
Which one is correct?
by snibgo » 2015-11-16T18:36:28+01:00:
> Many of the effect filters (and colours in general) assume the input is sRGB, so you should convert to sRGB first.
by snibgo » 2015-11-18T19:48:40+01:00:
> No. Many filters assume the channels represent red, green and blue, but not that the colorspace is sRGB.
Which one is correct?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sepia-Tone makes image blue
Well spotted. The second is correct. The first should say "Many of the effect filters (and colours in general) assume the input is RedGreenBlue, so you should convert to RedGreenBlue first."
(I would abbreviate this to RGB, but that term is used by IM to mean a particular colorspace.)
As a general rule, if you don't know what colorspace you need, use sRGB. But other colorspaces are available.
(I would abbreviate this to RGB, but that term is used by IM to mean a particular colorspace.)
As a general rule, if you don't know what colorspace you need, use sRGB. But other colorspaces are available.
snibgo's IM pages: im.snibgo.com