Page 2 of 2

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T17:20:55-07:00
by snibgo
Modern web (and other) software assumes that colour images are encoded as (non-linear) sRGB rather than (linear) RGB, unless told otherwise. Even if told otherwise by gamma flag etc in PNG files, much software ignores this and treats it as sRGB.

For this reason, I think using RGB for web applications is unwise. If the user specifies colours in RGB, these can easily be converted to sRGB, or vice versa, eg:

Code: Select all

F:\web\im>%IM%convert xc:rgb(239,152,50) -set colorspace RGB -colorspace sRGB -d
epth 8 txt:
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: (248,203,122)  #F8CB7A  srgb(248,203,122)

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T17:29:32-07:00
by mackermedia
I tried the 3 examples that you posted at the bottom, and they all look the same. I did notice an error output while running the command:

convert: ColorspaceColorProfileMismatch `icc' @ error/profile.c/ProfileImage/588.

. The resultant images look like: https://dl.dropboxusercontent.com/spa/l ... x93nat.png

Am I missing something obvious? Is it possible the files I found are bad? Could you share the ones you are using?

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T17:29:52-07:00
by fmw42
snibgo wrote:Modern web (and other) software assumes that colour images are encoded as (non-linear) sRGB rather than (linear) RGB, unless told otherwise. Even if told otherwise by gamma flag etc in PNG files, much software ignores this and treats it as sRGB.

For this reason, I think using RGB for web applications is unwise. If the user specifies colours in RGB, these can easily be converted to sRGB, or vice versa, eg:

Code: Select all

F:\web\im>%IM%convert xc:rgb(239,152,50) -set colorspace RGB -colorspace sRGB -d
epth 8 txt:
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: (248,203,122)  #F8CB7A  srgb(248,203,122)
I would agree with snibgo, also. Linear RGB is not a good colorspace to which to save as most format and viewers cannot handle it.

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T17:31:22-07:00
by fmw42
mackermedia wrote:I tried the 3 examples that you posted at the bottom, and they all look the same. I did notice an error output while running the command:

convert: ColorspaceColorProfileMismatch `icc' @ error/profile.c/ProfileImage/588.

. The resultant images look like: https://dl.dropboxusercontent.com/spa/l ... x93nat.png

Am I missing something obvious? Is it possible the files I found are bad? Could you share the ones you are using?
What version of IM and what platform and what viewer. I used the IM display (show:) in unix on my Mac and they can clearly be seen to differ. But it takes a good viewer to properly handle profiles.

I do not know why you got an error unless you do not have the exact same profiles and you will of course need to put them on your system in a different location that I did and reference your path to them

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T17:57:49-07:00
by mackermedia
Can you please give me an example of a specific display command that you used to view these? I'm using Preview in OSX as the Viewer. I'm also using the OSX Color Utility to determine sRGB vs Generic RGB values.

Also, I wasn't able to get the command to work to convert rgb values and srgb values (convert xc:rgb(239,152,50) -set colorspace RGB -colorspace sRGB -d
epth 8 txt:). It's failing on the last part of the command which ends in `txt:`

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T18:12:50-07:00
by fmw42
there is no txt: in my commands
fmw42 wrote:convert -size 100x100 xc:"rgb(239,152,59)" -depth 8 orange_srgb.tif

convert -size 100x100 xc:"icc-color(rgb,0.937,0.596,0.231)" -profile /Users/fred/images/Profiles/sRGB.icc -profile /Users/fred/images/Profiles/GenericRGBProfile.icc -depth 8 orange_rgb.tif

convert -size 100x100 xc:"rgb(239,152,59)" -profile /Users/fred/images/Profiles/sRGB.icc -profile /Users/fred/images/Profiles/GenericRGBProfile.icc -depth 8 orange_rgb2.tif

convert orange_srgb.tif show:
convert orange_rgb.tif show:
convert orange_rgb2.tif show:
the

convert image show:

does the display in IM.

Or to compare them in a flickering display, just do

animate -delay 50 orange_srgb.tif orange_rgb.tif

P.S. If you open them both up in Preview in the same window and use the arrow keys to alternate between the two images you can see there is a slight difference in darkness of the color. The linear RGB will be darker. It seems to be a bit more obvious using animate.

Re: sRGB to RGB colorspace / profile not working?

Posted: 2014-02-04T19:07:31-07:00
by snibgo
That was my command that ended in "txt:". Sorry, the cut-paste put a new line in it.

Code: Select all

[code]F:\web\im>%IM%convert xc:rgb(239,152,50) -set colorspace RGB -colorspace sRGB -depth 8 txt:
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: (248,203,122)  #F8CB7A  srgb(248,203,122)
[/code]
The command is just:

Code: Select all

convert xc:rgb(239,152,50) -set colorspace RGB -colorspace sRGB -depth 8 txt: