Png save and screen capture producing different results

has anyone else noticed saving a frame to png alters the colors from processing?

i setup a code that just randomly creates 100 squares of random colors. i save the frame as a png and take a screen shot. the colors are subtly different. but the difference become greater the redder the color.

same results do not happen when save screen to tiff.

is this a png native issue?

size(100, 100);
for (int i=0; i<10; i++) {
for (int j=0; j<10; j++) {
noStroke();
fill(random(255), random(255), random(255));
rect(i10, j10, 10, 10);
}
}
saveFrame(“out.png”);

it’s the darnedest thing

I think it’s color management issue. RGB color (or any colors) are always associated with a color profile. Color profile is device dependent and it tells how to present a color in the device. Print screen happens on os level and os links used display (color) profile to the file. I assume that processing does not link any profile to png and therefore os uses standard profile with it, which may be correct or not.

1 Like

if this is so, why would a tiff saveFrame be accurate but a png output have different results?

I don’t know. Not enough information to tell. I just know from long experience with image editing and photographs that such differences with colors most often are caused by problems or differences with color profiles