You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method name ImageUtils.getPixelsBGR(...) is quite confusing since the returning data is in RGBA format. Reproducible with the following lines:
BufferedImage image= new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR);
image.setRGB(0, 0, (new Color(100, 0, 0, 255)).getRGB());
byte[] pixel = new byte[4];
ImageUtils.getPixelsBGR(image, 0, 1, pixel, null);
System.out.println(Arrays.toString(pixel));
I expected [-1,0,0,100] but got [100,0,0,-1]. Tested with Java 8u40 on Windows 8.1.
PS: The method does not work if the temp variable is null only for TYPE_BYTE. A structure like this would help: temp = (int[]) raster.getDataElements(x, y, w, h, temp);
The text was updated successfully, but these errors were encountered:
The method name ImageUtils.getPixelsBGR(...) is quite confusing since the returning data is in RGBA format. Reproducible with the following lines:
I expected [-1,0,0,100] but got [100,0,0,-1]. Tested with Java 8u40 on Windows 8.1.
PS: The method does not work if the temp variable is null only for TYPE_BYTE. A structure like this would help: temp = (int[]) raster.getDataElements(x, y, w, h, temp);
The text was updated successfully, but these errors were encountered: