Pixel array into Image

D

D i s h a n

Hi,
Is there anyway to convert Pixel array (from PixelGrabber) into gif/jpg
image (Black and White) programmatically ?
Thanks
-Dish.
 
D

Daniel Pitts

D said:
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.
 
K

Knute Johnson

Daniel said:
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.
 
D

Daniel Pitts

Knute said:
Daniel said:
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.
I can think of a few, but all of them involve saving in an otherwise
unsupported file/compresson format.
 
D

D i s h a n

Hi, Reason is this.. I dont have original content file(gif) rather than
just pixel byte array. Thats why I want to convert that byte array into
gif image backword.
Thanks in advance
Dish

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.

Knute Johnson
email s/nospam/knute/I can think of a few, but all of them involve saving in an otherwise
unsupported file/compresson format.- Hide quoted text -- Show quoted text -
 
K

Knute Johnson

D said:
Hi, Reason is this.. I dont have original content file(gif) rather than
just pixel byte array. Thats why I want to convert that byte array into
gif image backword.
Thanks in advance
Dish

Knute said:
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.
unsupported file/compresson format.- Hide quoted text -- Show quoted text -

BufferedImage.setRGB()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top