Image processing in Java

Discussion in 'Java' started by Wayne, Feb 9, 2011.

  1. Wayne

    Wayne Guest

    How can I obtain the raster data from an Image, without serializing it
    to disk?
    Wayne, Feb 9, 2011
    #1
    1. Advertising

  2. Wayne

    Stefan Ram Guest

    Wayne <> writes:
    >How can I obtain the raster data from an Image, without
    >serializing it to disk?


    By looking up the documentation of the image's class.
    Stefan Ram, Feb 9, 2011
    #2
    1. Advertising

  3. Wayne

    Mayeul Guest

    On 09/02/2011 18:14, Wayne wrote:
    > On 2/8/2011 9:22 PM, Stefan Ram wrote:
    >> Wayne<> writes:
    >>> How can I obtain the raster data from an Image, without
    >>> serializing it to disk?

    >>
    >> By looking up the documentation of the image's class.
    >>

    >
    > I did, there was no method that gets the raw data out of an
    > Image that I saw. What method are you thinking of?


    getSource() probably. Just need to look up the chain from it.

    Note that this is a necessity for the absolutely all-purpose generic
    Image class. If you happen to be manipulating an instance of its
    BufferedImage subclass, and if you can assume you always will, you will
    notice it offers more direct access to buffered data.

    --
    Mayeul
    Mayeul, Feb 9, 2011
    #3
  4. Wayne

    Lew Guest

    Wayne writes:
    >>>> How can I obtain the raster data from an Image, without serializing it to disk?

    >


    Stefan Ram wrote:
    >>>    By looking up the documentation of the image's class.

    >


    Wayne wrote:
    >> I did, there was no method that gets the raw data out of an
    >> Image that I saw.  What method are you thinking of?

    >


    Mayeul wrote:
    > getSource() probably. Just need to look up the chain from it.
    >
    > Note that this is a necessity for the absolutely all-purpose generic
    > Image class. If you happen to be manipulating an instance of its
    > BufferedImage subclass, and if you can assume you always will, you will
    > notice it offers more direct access to buffered data.
    >


    Ah, the fine art of RTFMing.

    'getSource()' is the only one of the fewer than eleven methods that
    has the verbiage: "Gets the object that produces the pixels for the
    image." That seems relevant to the OP's question, so one must ask
    oneself, "What sort of object is that, pray tell?" (Assuming you see
    "pixels for the image" and understand that as a synonym for "raster
    data from an Image", which surely anyone would.) (Right?)

    So you look up that type, which is 'ImageProducer', by clicking on the
    handy-dandy link so politely offered in the description of the
    'getSource()' method. Then you iteratively apply the technique for a
    while, until it lands you on 'PixelGrabber', which seems to do what
    you want.
    <http://download.oracle.com/javase/6/docs/api/java/awt/image/
    PixelGrabber.html>

    As Mayeul pointed out, 'BufferedImage' is marginally more direct, if
    you call working through a 'Raster' more direct. (I do.)

    When all else fails, you could try reading articles or a book. It's
    not like the art of programming requires study beyond a few Usenet
    questions or anything.

    --
    Lew
    Lew, Feb 9, 2011
    #4
  5. Wayne

    Roedy Green Guest

    On Wed, 9 Feb 2011 11:48:31 -0800 (PST), Lew <>
    wrote, quoted or indirectly quoted someone who said :

    >
    >So you look up that type, which is 'ImageProducer', by clicking on the
    >handy-dandy link so politely offered in the description of the
    >'getSource()' method. Then you iteratively apply the technique for a
    >while, until it lands you on 'PixelGrabber', which seems to do what
    >you want.
    ><http://download.oracle.com/javase/6/docs/api/java/awt/image/
    >PixelGrabber.html>


    THe problem is pixel grabbing has gone through evolution. There is a
    considerable amount of old code in there you would want to avoid in
    new applications. The docs are not as forthcoming on this as you
    might hope.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Refactor early. If you procrastinate, you will have
    even more code to adjust based on the faulty design.
    ..
    Roedy Green, Feb 11, 2011
    #5
    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. mike
    Replies:
    10
    Views:
    8,401
    Cristian
    Feb 6, 2009
  2. Andrew

    Image Processing

    Andrew, Apr 28, 2004, in forum: Perl
    Replies:
    2
    Views:
    557
    Frank Sonnemans
    Jun 15, 2004
  3. Hubert Hung-Hsien Chang
    Replies:
    2
    Views:
    402
    Michael Foord
    Sep 17, 2004
  4. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,237
    Kartic
    Jan 26, 2005
  5. =?ISO-8859-1?Q?Rapha=EBl_MARC?=

    Processing an image with numarray.nd image

    =?ISO-8859-1?Q?Rapha=EBl_MARC?=, Oct 4, 2005, in forum: Python
    Replies:
    1
    Views:
    405
    Matt Feinstein
    Oct 4, 2005
Loading...

Share This Page