Pixel array into Image

Discussion in 'Java' started by D i s h a n, Jan 8, 2007.

  1. D i s h a n

    D i s h a n Guest

    Hi,
    Is there anyway to convert Pixel array (from PixelGrabber) into gif/jpg
    image (Black and White) programmatically ?
    Thanks
    -Dish.
     
    D i s h a n, Jan 8, 2007
    #1
    1. Advertising

  2. D i s h a n

    Daniel Pitts Guest

    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.
     
    Daniel Pitts, Jan 8, 2007
    #2
    1. Advertising

  3. 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.

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 8, 2007
    #3
  4. D i s h a n

    Daniel Pitts Guest

    Knute Johnson wrote:
    > 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.
    >
    > --
    >
    > 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.
     
    Daniel Pitts, Jan 9, 2007
    #4
  5. D i s h a n

    D i s h a n Guest

    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

    On Jan 9, 6:20 am, "Daniel Pitts" <> wrote:
    > Knute Johnson wrote:
    > > 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.

    >
    > > --

    >
    > > 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 -
     
    D i s h a n, Jan 9, 2007
    #5
  6. D i s h a n wrote:
    > 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
    >
    > On Jan 9, 6:20 am, "Daniel Pitts" <> wrote:
    >> Knute Johnson wrote:
    >>> 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.
    >>> --
    >>> 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 -

    >


    BufferedImage.setRGB()

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 9, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter the Swede

    Pixel colorvalue in an Image

    Peter the Swede, Nov 11, 2003, in forum: Java
    Replies:
    3
    Views:
    1,729
    Peter the Swede
    Nov 11, 2003
  2. rfractal30
    Replies:
    5
    Views:
    6,964
    rfractal30
    Mar 6, 2005
  3. Sinora
    Replies:
    1
    Views:
    873
    David White
    Nov 11, 2003
  4. Jean
    Replies:
    2
    Views:
    3,824
    Daniel Pitts
    Jan 4, 2007
  5. André Wagner

    Fastest pixel by pixel operation

    André Wagner, Mar 17, 2008, in forum: Java
    Replies:
    12
    Views:
    1,070
    Larry A Barowski
    Mar 19, 2008
Loading...

Share This Page