Welcome to the Java "great" world of implicit color management!
Java ( , ImageIO) sRGB, , , .
, , ImageIO , , ICC ( ), Java "" ICC WhitePoint = D50, Gamma = 1.0, .
, (, img.getRGB() - ?), sRGB ( Java Windows).
sRGB, ~ 2.2 (sRGB- , 2.2 ), - (1/Gamma) = 2.2 , () "", (b) - - 256 256 .
, BufferedImage -:
a) :
ColorSpace colorSpace = img.getColorModel().getColorSpace();
if ( colorSpace instanceof ICC_ColorSpace ) {
ICC_Profile profile = ((ICC_ColorSpace)colorSpace).getProfile();
if ( profile instanceof ICC_ProfileGray ) {
float gamma = ((ICC_ProfileGray)profile).getGamma();
system.out.println("Gray Profile Gamma: "+gamma);
}
}
b) -...
System.out.println( "pixel 0,0 value (sRGB): " + Integer.toHexString(img.getRGB(0,0)) );
Raster raster = image.getRaster();
System.out.println( "pixel 0,0 value (RAW gray value): " + Integer.toHexString(raster.getSample(0,0,0)) );
(0,0) 100% 100% , , sRGB "", , , gray = d1 → sRGB = ffeaeaea ( , , , ).
, , ( , - 1/- 2,2). , Java ICC sRGB R = G = B = grayValue ICC Grey WhitePoint = D50, Gamma = 2.2 ( , Windows). - , sRGB Gamma 2.2.
, GIF: GIF " " ICC, 256- (256 256 ). GIF Java , RGB sRGB.
:
, , (gray = raster.getSample(x, y, 0)) sRGB R = = = . .
java PNG:
java ImageIO , . , , . , sRGB ( sRGB , , sRGB). , (, AdobeRGB). - , , ImageIO () Gray Profile Gamma = 1.0. , , ImageIO, ABC , , Java. ! : ImageIO , , , . , , , , , , .