TameHog
TameHog

Reputation: 950

java BufferedImage to int[] issue

I have a BufferedImage (Type.TYPE_INT_ARGB) that I want to convert to a int[]. I do this by using the following method: ((DataBufferInt)src.getRaster().getDataBuffer()).getData();. But when I do this with an image, it gives me the wrong array size. For a 320 x 240 Image it makes a 57,600 size int[] when it should give me a 78,600 size array. Do you know what I am doing wrong?

Upvotes: 0

Views: 127

Answers (1)

user2282497
user2282497

Reputation: 191

What's wrong with

src.getRGB(0,0,image.getWidth(),image.getHeight(),null,0,1);

Upvotes: 1

Related Questions