Login  Register

What colour is RGB black?

Posted by Gabriel Landini on Jun 20, 2016; 3:21pm
URL: http://imagej.273.s1.nabble.com/What-colour-is-RGB-black-tp5016697.html

I should know this... but when I resize a canvas, I get a different value for
black, even if inspecting the pixels shows (000,000,000) when I use the "zero"
parameter.
.
Running the macro below with the background set in the colour picker set to
white for the foreground and black for the background I get these two values
for the background pixel at (0,0) :

-16777216
0

newImage("Untitled", "RGB white", 128, 128, 1);
run("Canvas Size...", "width=150 height=150 position=Center");
print(getPixel(0,0));
close();

newImage("Untitled", "RGB white", 128, 128, 1);
run("Canvas Size...", "width=150 height=150 position=Center zero");
print(getPixel(0,0));

I guess that it has to do with the representation of the RGB triplet, but I am
most puzzled about it since they both are the same colour (or so I though!).
Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html