private static byte[] get_byte_data(BufferedImage image)
{
//WritableRaster raster = image.getRaster();
DataBufferByte buffer = (DataBufferByte)image.getRaster().getDataBuffer();
return buffer.getData();
}
I get the stated class cast exception while executing the above piece of code. I need the byte[] array to be returned. i.e the bytes of the bufferedimage.
The raster data is not necessarily bytes.
if (image.getRaster().getDataTypeSize() == 1), then you can usegetElem(int bank, int i)for all banks and all elements, and store the results in the desired array. I don’t see anything more direct.