IM 6.7.6.4 Q16 Mac OSX Snow Leopard.
I am not able to get a round trip separate and combine of the rose image when specifying either -colorspace sRGB or -colorspace RGB
This is too light.
convert rose: -colorspace sRGB -channel R -separate 1rose_r.png
convert rose: -colorspace sRGB -channel G -separate 1rose_g.png
convert rose: -colorspace sRGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -colorspace sRGB -combine show:
And this is too dark.
convert rose: -colorspace RGB -channel R -separate 1rose_r.png
convert rose: -colorspace RGB -channel G -separate 1rose_g.png
convert rose: -colorspace RGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -colorspace RGB -combine show:
This however works without any colorspace.
convert rose: -channel R -separate 1rose_r.png
convert rose: -channel G -separate 1rose_g.png
convert rose: -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -combine show:
convert rose: -colorspace RGB -channel G -separate 1rose_g.png
convert rose: -colorspace RGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -colorspace RGB -combine show:
possible colorspace issue IM 6.7.6.4 Q16
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible colorspace issue IM 6.7.6.4 Q16
try using -set colorspace XXX before the -combine
Using -colorspace modifies the grayscale image data!
This is one reason why I have never been happy with this 'hack' of specifying the combine colorspace.
The destination colorspace probably should be a argument of -combine as the input images does not contain this information.
Using -colorspace modifies the grayscale image data!
This is one reason why I have never been happy with this 'hack' of specifying the combine colorspace.
The destination colorspace probably should be a argument of -combine as the input images does not contain this information.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible colorspace issue IM 6.7.6.4 Q16
anthony wrote:try using -set colorspace XXX before the -combine
Using -colorspace modifies the grayscale image data!
This is one reason why I have never been happy with this 'hack' of specifying the combine colorspace.
The destination colorspace probably should be a argument of -combine as the input images does not contain this information.
The problem is that I am trying to make several scripts behave as they used to before the swap of RGB and sRGB.
I will have to find out how to make it work with the current release and reinstall an older IM to be sure it still works right.
I was under the impression that if the input image is sRGB and I add -colorspace sRGB before the -separate, that it should not change the image data. Similarly adding -colorspace sRGB before the combine would also be a non-change. Is this an issue of going from 3 grayscale images to any colorspace when doing -combine, even for sRGB (previously RGB)? Seems like one used to be able to use -colorspace RGB before, but perhaps I do not remember correctly.
OK. These do work.
convert rose: -colorspace sRGB -channel R -separate 1rose_r.png
convert rose: -colorspace sRGB -channel G -separate 1rose_g.png
convert rose: -colorspace sRGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -set colorspace sRGB -combine show:
convert rose: -colorspace sRGB -channel R -separate 1rose_r.png
convert rose: -colorspace sRGB -channel G -separate 1rose_g.png
convert rose: -colorspace sRGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -set colorspace sRGB -combine -colorspace sRGB show:
So I suppose the latter with the added -colorspace sRGB is redundant and is not needed.
I will modify my script again and check my trapping in an old version of IM as well. Furthermore, now I need to figure out what to do before we had -set colorspace. It is getting hard to support lots of old versions.
Thanks.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible colorspace issue IM 6.7.6.4 Q16
If the image is already sRGB then it shouldn't change. except posibly in IMv7 of ensuring a grayscale image is converted to a three image sRGB. However is that conversion from a linear-GRAY or sGRAY???? This is an aspect that has NOT been looked at.fmw42 wrote:I was under the impression that if the input image is sRGB and I add -colorspace sRGB before the -separate, that it should not change the image data.
The problem with the -colorspace option (as it currently exists, and I have not changed it) is that it is not just an operator for existing images but also used as setting for FUTURE image reads.
Though I am not certain of exactly what it does for image reads as these are buried in the library core and individual coders. You'll have to ask "magick. I think the setting typically only sets the default colorspace when not defined by the image file format.
Unsetting it +colorspace will stop it effecting new image read, but that also effects
existing images by forcing them to be RGB! I would probably regard this as a bug -- and should be removed!
Fortunatally in parenthesis their are no images to effect, so...
Code: Select all
convert image_reads... -colorspace sRGB \( +colorspace \) .....
Really it depends on just what the operator does for new images.
Suggestions welcome as to what I should do about this! Feedback from magick would be most helpful at this point.
I would think so, but in IMv7 it probably depends on how conversions from single channel images are performed!Similarly adding -colorspace sRGB before the combine would also be a non-change.
Do they work for IMv7 too? if so then grayscale images are actually sGRAY.OK. These do work.
convert rose: -colorspace sRGB -channel R -separate 1rose_r.png
convert rose: -colorspace sRGB -channel G -separate 1rose_g.png
convert rose: -colorspace sRGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -set colorspace sRGB -combine show:
convert rose: -colorspace sRGB -channel R -separate 1rose_r.png
convert rose: -colorspace sRGB -channel G -separate 1rose_g.png
convert rose: -colorspace sRGB -channel B -separate 1rose_b.png
convert 1rose_r.png 1rose_g.png 1rose_b.png -set colorspace sRGB -combine -colorspace sRGB show:
So I suppose the latter with the added -colorspace sRGB is redundant and is not needed.
I suggest you make an archive of your scripts from 'before IM version X.X.X' .I will modify my script again and check my trapping in an old version of IM as well. Furthermore, now I need to figure out what to do before we had -set colorspace. It is getting hard to support lots of old versions.
But if users want new features, they need the newer IM version too.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible colorspace issue IM 6.7.6.4 Q16
My tests were with the rose: image for which the verbose info says it is sRGBIf the image is already sRGB then it shouldn't change. except posibly in IMv7 of ensuring a grayscale image is converted to a three image sRGB. However is that conversion from a linear-GRAY or sGRAY???? This is an aspect that has NOT been looked at.
I have not tested and would not think they would work as magick said he has not decided how to handle grayscale image promoted to color.Do they work for IMv7 too? if so then grayscale images are actually sGRAY.
________
On a similar note, what happens if one has an image that has an undefined colorspace? How does IM handle it. Does it treat it as sRGB? My concern is that I am assuming the image can be converted from some colorspace (e,g, sRGB or CMYK) to sRGB. But what if the image does not have any colorspace assigned and I use
convert image -colorspace sRGB -channel R -separate result
Will it treat it as if it was sRGB and thus the -colorspace sRGB would have not effect?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible colorspace issue IM 6.7.6.4 Q16
Soem tests...
Note show: does not seem to automatically change colorspace, it simply displays the image data AS IS.
It is really just "miff:" piped into a background "display" command.
image data is normal linear data, displayed with more black than white (as typically seen)
image data has not changed...
image data was modified to be brighter for sRGB usage (visually more equal in intensity)
As such it looks like 'undefined' is acting more like it is linear-RGB colorspace!
Note show: does not seem to automatically change colorspace, it simply displays the image data AS IS.
It is really just "miff:" piped into a background "display" command.
Code: Select all
convert -size 200x200 gradient: show:
Code: Select all
convert -size 200x200 gradient: -set colorspace undefined -colorspace RGB show:
Code: Select all
convert -size 200x200 gradient: -set colorspace undefined -colorspace sRGB show:
As such it looks like 'undefined' is acting more like it is linear-RGB colorspace!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible colorspace issue IM 6.7.6.4 Q16
Do you think this should be changed so that it behaves more like sRGB?As such it looks like 'undefined' is acting more like it is linear-RGB colorspace!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible colorspace issue IM 6.7.6.4 Q16
I am not certain what undefined should mean.
It depends on what the -colorspace setting (setting not operation) means to images that are read in later!
It depends on what the -colorspace setting (setting not operation) means to images that are read in later!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/