Hey, I am trying to analyze an image to find its brightest spot with Applescript, but I don’t know what application I need to tell to do it. Anyone know if any application has the ability to be scripted to do this (and maybe the command I need to use)? Thanks.

I actually found a program that tells you values for every pixel of the image… but it returns the values in a strange numbering system (for example : 0000433E). Does anyone know how to convert this to an RGB value?

The number system is hexadecimal.

Hexadecimal requires 16 values per digit

decimal

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

hexadecimal

0 1 2 3 4 5 6 7 8 9 A B C D E F

Without documentation how to interpret your number is a guess but here goes:

The first two digits 00 represent the alpha channel for transparency. If tranparency is available 00 would indicate fully transparent, and FF fully opaque, my guess is that your image doesn’t support transparency.

The next two digits, once again 00, probably represent red, and 00 indicates that there is no red for that pixel.

The next two digits 43 probably represent green, and has a value of:

4 * 16 + 3 = 67

and if we divide by the maximum value that can be represented using this numbering scheme FF which is equal to 255 in decimal

then we get:

0.263, or in other words about 26.3 % for green.

The last digit probably represents blue:

3E is 62

which gives about 24.3 % for blue.

Now this may be all completetly wrong because your image may be represented by a CMYK color space rather than a RGB one, but hopefully it gives you the correct idea about how to interpret the number.

Short plug:

My applescript tool iMagine Photo allows you to get all the pixel values along a line, in a rectangle, in a polygon, in a oval, or at specific points. It returns the value of the pixel plus the coordinates all in decimal. You do need to be a bit careful with it though as it can produce huge amounts of data, a rectangle 100 pixels wide and 100 pixels tall contains 10,000 pixels. Since using my scheme takes up at least 10 bytes per pixel, that is a minimum of 100,000 bytes that AppleScript will have to manage for one object and that is just a small rectangle.

Kevin