Forum Moderators: coopster

Message Too Old, No Replies

Correctly ordered all colour image

Trying to get black at top left progressing to white at bottom right

         

ocpaul20

1:48 am on Jul 12, 2010 (gmt 0)

10+ Year Member



I am trying to write a square image with all the colours in it. I have searched google for a script or an explanation but nothing immediately obvious.

as I understand it, this image would contain all values for red, green & blue from 0 to 255 each, so 3 'for' loops should sort it. However, it does not look good and so there must be more to it than this and I cannot find an explanation how to get all blacks, all blues, all greens etc progressing nicely into one another from top to bottom.

I can write the code if someone can please explain how I get a nicely ordered image starting with 0,0,0 for black in the top left and ending up at the bottom right corner with 255,255,255 for white.

Thanks,
Paul

lammert

2:12 am on Jul 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Colors have different sorting orders. You can sort them as Red->Green->Blue, but also on Hue->Saturation->Luminance or Cyan->Magenta->Yellow->Black for example.

The main problem with all those color spaces is that they have more than two dimensions, while you want to plot them in a two dimensional space in a flat graphics file. This won't work, unless you do some combining of colors, or use separate graphs to display different parts of the color spectrum. Looking at the color selector pallets in drawing programs may give you some ideas how you can present the colors in such a way that they will look appealing on the screen.

ocpaul20

3:53 am on Jul 12, 2010 (gmt 0)

10+ Year Member



OK, thanks for your reply. I think what I have to do is to convert/use the HSL colour system. I have found a good article here [dba.med.sc.edu] which seems to explain it all quite well. Obviously with the rgb system, there are 16 million odd possible colours which requires a 4096x4096 image to display each pixel as a different rgb colour. So I will investigate converting the hsl value to rgb and displaying that.