Image processing in Java

M

Mayeul

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

Lew

Wayne writes:
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.
 
R

Roedy Green

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

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top