How do you simply obtain an array of pixel data from an image by java?

95 views Asked by At

I need to work code to analyze the image to pixels in the form of an array. Please help me

1

There are 1 answers

0
camickr On

Paint the Image to a BufferedImage:

BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = bi.createGraphics();
graphics.drawImage(originalImage, 0, 0, null);
graphics.dispose();

Now you can use method of the BufferedImage class to manipulate the image.

Maybe using the getRGB(...) or getSubImage(...) methods?