Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing ImageUtils.getPixelsBGR(...) method name #38

Open
Neiko2002 opened this issue Aug 11, 2015 · 0 comments
Open

Confusing ImageUtils.getPixelsBGR(...) method name #38

Neiko2002 opened this issue Aug 11, 2015 · 0 comments

Comments

@Neiko2002
Copy link

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant