Skip to content

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

Description

@Neiko2002

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions