JavaでImageコピーをしたい場合に、ピクセル単位で何か処理をしたい時があります。そのような時は次のようにデータを取り出して処理をするとよいでしょう。
imageにはImageIO.readなどで画像データを読み込んでいるとして、destImageが参照するint[]へピクセル情報をコピーしています。
int width = image.getWidth(); int height = image.getHeight(); int size = width * height; BufferedImage destImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); int[] dest = ((DataBufferInt)(destImage.getRaster().getDataBuffer())).getData(); byte[] src = ((DataBufferByte)(image.getRaster().getDataBuffer())).getData(); int r, g, b, a; for(int i=0, j=0;i<size;i++) { a = src[j++] & 0xFF; r = src[j++] & 0xFF; g = src[j++] & 0xFF; b = src[j++] & 0xFF; dest[i] = (a<<24)|(r<<16)|(g<<8)|b; }