Hi all,
I’m having a few problems processing my images. I’ve got the following method that takes an image and creates a int array to hold all the pixel values. This seems to work fine, but it is when I need to recreate an image from this data that is posing a problem:
Image processImage(Image src) {
int w = src.getWidth();
int h = src.getHeight();
int[] pixels = new int[w*h];
src.getRGB(pixels,0,w,0,0,w,h);
// The following line seems to be throwing illegal argument exceptions:
Image dest = Image.createRGBImage(pixels, w, h, true);
return(dest);
}
I’ve tried to use the DirectGraphics and DirectUtils methods to draw the pixels but this results in Illegal State Exceptions.
Any help on this matter would be much appreciated! It should be simple, but I’m not sure where I’m going wrong.
Regards,
ribot