0% found this document useful (0 votes)
18 views1 page

Color Picker Tool

This macro displays the coordinates and RGB values of pixels when the user positions the cursor over an image. It extracts the red, green, and blue component values from the pixel if the image has 24-bit color, or it just displays the pixel value if not.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Color Picker Tool

This macro displays the coordinates and RGB values of pixels when the user positions the cursor over an image. It extracts the red, green, and blue component values from the pixel if the image has 24-bit color, or it just displays the pixel value if not.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

// This tool displays the coordinates and RGB values of pixels

macro "Color Picker Tool -C44f-o4499" {


requires("1.30k");
getCursorLoc(x, y, z, flags);
v = getPixel(x,y);
if (bitDepth==24) {
red = (v>>16)&0xff; // extract red byte (bits 23-17)
green = (v>>8)&0xff; // extract green byte (bits 15-8)
blue = v&0xff; // extract blue byte (bits 7-0)
if (nSlices>1)
print("x="+x+", y="+y+", z="+z+", value=("+red+","+green+","+blu
e+")");
else
print("x="+x+", y="+y+z+", value=("+red+","+green+","+blue+")")
;
} else
if (nSlices>1)
print("x="+x+", y="+y+", z="+z+", value="+v);
else
print("x="+x+", y="+y+", value="+v);
}

You might also like