davidb2002 wrote:Hi,
Our Server Admin suggest that we don't do the upgrade as it would require an RPM install of it which is not built for the OS we are running.
How do you convert a hex value to the corresponding name like you mentioned?
Did you find out if the IM function was converting the hex values correctly as I asked? You need to know where the problem lies, before working out a solution. Please report back whether the IM function I suggested was converting the hex values correctly compared to the web sites that I sent you.
With regard to color names:
You have to convert first to get the r and g and b components in the range 0-255 and then you will have to build a lookup from that value in range 0-255 to the list of grayvalue names in the IM list of colornames (but map each value in the range of 0-255 to only one grayname as sometimes there are two graynames that are equivalent.
I have given you a function to convert the hex values to r, g, b components.
See:
http://imagemagick.org/script/color.php
Build a file lookup.txt with two columns. One column is the color value in range 0-255 and the next column (space or comma separated) is the grayname.
Then you will have to build a shell function to search the file and find the grayname given a value
But you also need to test that you can do it correctly even using the colornames. You need to manually convert one of the hex values that is giving you trouble to r,g,b components in the range 0-255, then look at the color name page, find the correct name, then build your color patch image and see if that all works.
P.S. In looking at the page for color names above, I see that not every gray value is represented by a name. Therefore this may not be an adequate solution for you.
However, I reiterate, that you need to identify where the problem really lies. Take your system with the oldest IM version on it and do the following where you reported that #FF6600 gave the wrong value:
1) convert -size 1x1 xc:"#FF6600" -format "rgb(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)])" info:
This should report: rgb(
255,102,0)
Let us know what you get.
2) convert -size 1x1 xc:"#FF6600" -depth 8 txt:
This should report:
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: (
255,102, 0) #FF6600 rgb(
255,102,0)
Possibly the left or right side values may not be showing (255,102,0)
Let us know what you get.
3) convert -size 100x100 xc:"rgb(255,102,0)" test_color.png
4) identify -verbose test_color.png
This should report:
Channel statistics:
red:
min: 15 (1)
max: 15 (1)
mean: 15 (1)
standard deviation: -0 (-0)
green:
min: 6 (0.4)
max: 6 (0.4)
mean: 6 (0.4)
standard deviation: -0 (-0)
blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
Histogram:
10000: (65535,26214, 0) #FFFF66660000 rgb(
255,102,0)
Let us know what you get for all the above. NOTE: the unnormalized values of 15,6,0 may not be correctly reported. This appears to be a bug in the current version as I would expect on Q16 IM to get 65535,26214,0. However, the normalized values in parentheses are correct as 1,0.4,0
5) convert -size 100x100 xc:"#FF6600" test_color_hex.png
6) identify -verbose test_color_hex.png
This should return:
Channel statistics:
red:
min: 15 (1)
max: 15 (1)
mean: 15 (1)
standard deviation: -0 (-0)
green:
min: 6 (0.4)
max: 6 (0.4)
mean: 6 (0.4)
standard deviation: -0 (-0)
blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
Histogram:
10000: (65535,26214, 0) #FFFF66660000 rgb(
255,102,0)
Let us know what you get for all the above.
7) convert -size 100x100 xc:"#FF6600" -colorspace rgb test_color_hex2.png
\8) identify -verbose test_color_hex2.png
This should return:
Channel statistics:
red:
min: 15 (1)
max: 15 (1)
mean: 15 (1)
standard deviation: -0 (-0)
green:
min: 6 (0.4)
max: 6 (0.4)
mean: 6 (0.4)
standard deviation: -0 (-0)
blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
Histogram:
10000: (65535,26214, 0) #FFFF66660000 rgb(
255,102,0)
Let us know what you get for all the above.
9) 255 is gray name white; 102 is gray name gray40; 0 is gray name black
So try
convert -size 100x100 xc:white xc:gray40 xc:black -combine test_color3.png
10) identify -verbose test_color3.png
This should return:
Channel statistics:
red:
min: 15 (1)
max: 15 (1)
mean: 15 (1)
standard deviation: -0 (-0)
green:
min: 6 (0.4)
max: 6 (0.4)
mean: 6 (0.4)
standard deviation: -0 (-0)
blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
Histogram:
10000: (65535,26214, 0) #FFFF66660000 rgb(
255,102,0)
Let us know what you get for all the above.
By the way, are you running Q16 or Q8 IM?