Daniel Pitts wrote:
D i s h a n wrote:
Hi,
Is there anyway to convert Pixel array (from PixelGrabber) into gif/jpg
image (Black and White) programmatically ?
Thanks
-Dish.
My understanding of PixelGrabber is that the PixelGrabber object is
initialized with a sub-region of an image. Why not just crop from the
original image?
BufferedImage image = new BufferedImage(width, height,
source.getType(), source.getColorModel);
image.getGraphics().drawImage(source, -sourceX, -sourceY, null);
Other than that, there are ways to convert a byte/int array to an
image, but its better if you don't have to mess with those details.
If you must, look up MemoryImageSource.
Actually BufferedImage has simple methods to convert an int[] to a
BufferedImage. But that aside, what are you really trying to do with
the PixelGrabber? I can't think of a single good reason to ever use one.