You can use the class
java.awt.image.PixelGrabber
to "grab" the pixels from an image into an array of integers. Remember
that a java pixel is just an integer with the high bits being "alpha"
going down from Red then Green then Blue ... RGB. Here's the code
snippet for monkeying the pixels from the API:
public void handlesinglepixel(int x, int y, int pixel) {
int alpha = (pixel >> 24) & 0xff;
int red = (pixel >> 16) & 0xff;
int green = (pixel >> 8) & 0xff;
int blue = (pixel ) & 0xff;
// Deal with the pixel as necessary...
}
Now once you have an array of ints that the pixel grabber has stuffed
with the pixels from an images, or an array you have created and done
your own image alogrithms to, the array is basically in the format of a
Windows BMP file and at this time you could write the pixels to disk
with a *.bmp file extension and Winblows would be able to read/show the
file A-OK in MSPaint. But you want a GIF right?? A GIF has its own
format so you would either have to roll your own GIF formatting
algorithm to work on the array or find something from a third party that
takes the array and makes a gif out of it.
Hope this helps.
Mike Mondragon