I’d like to convert a org.newdawn.slick.Image to an array of pixel and read its RGB. I understand there’s getColor(x,y) but wouldn’t that be awfully slow?
I wrote this code, but I don’t know how to get RGB or even if this works as intended.
public byte[] getImagePixels(Image img) {
return img.getTexture().getTextureData();
}
Another solution would be to convert img to a BufferedImage, but it seems impossible AFAIK.
Any help?