Pixel Question

Bob Warren bobwarren at howsoft.com
Fri Mar 24 11:02:21 EST 2006


I am happy to say that your function appears to be OK, and not slightly 
inaccurate as I reported. I don't know what happened because I certainly 
checked the image's colour values in Photoshop before making the 
comparison. However, as a result of what you said below, I went back to 
Photoshop and checked the values again, and lo-and-behold, the values 
were then exactly the same as those reported by your function! Anyway, I 
reduced the colour-depth of the picture and re-saved it as PNG this time 
(rather than JPG). The RGB values reported by the function were then 
exactly the same as those given by Photoshop.

Sorry for the confusion, and thanks again for the help.


Scott Rossi wrote:

Recently, Bob Warren wrote:

 >> Using a mouseMove routine on the top card such as:-
 >> on mouseMove
 >>  put retrievePixelColor(long id of image "myImage" \
 >>  of card "Card2",the mouseH,the mouseV) into field \
 >>  "ColourRGB" of card "Card1"
 >> end mouseMove
 >> - it works quite nimbly, even on my old Pentium II.
 >> However, there are some slight inaccuracies in the colours reported.
 >> For example:
 >> RED 255,0,0 is reported as 254,0,0
 >> GREEN 0,128,0 is reported as 0,128,1
 >> BLUE 0,0,255 is reported as 0,0,254
 >> YELLOW 255,255,0 is reported as 255,255,1
 >> WHITE 255,255,255 is OK.
 >> Without a better analysis of your function, I cannot see immediately
 >> what the trouble is. Can you see it Scott?

 >Well, the function pulls the color directly from the imagedata 
 >contained in
 >the image -- it doesn't do any manipulation, only reporting.  How are >you
 >gauging the accuracy of the color values?  The mouseColor?  In my 
 >the mouseColor is sometimes off.  Have you scaled the image at all?  I 
 >suggest opening your image in an image editor (Photoshop or similar) >and
 >measuring your colors there for reference.  You also might want to
 >doublecheck that you're measuring position correctly from the topleft 
 >of the
 >image.  That's about all I can think of -- I can also take a look at >your

 >Let us know what you find out.


 >Scott Rossi

More information about the Use-livecode mailing list