PixelGrabber question

B

buu

I'm trying to access a pixels from a part of an image, but it seems not
working.
How could I access a pixels from only a part of an image?
 
K

Knute Johnson

buu said:
I'm trying to access a pixels from a part of an image, but it seems not
working.
How could I access a pixels from only a part of an image?

Use a BufferedImage and use one of the getRGB() methods of that class.
 
T

Thomas Fritsch

buu said:
I'm trying to access a pixels from a part of an image, but it seems not
working.
It should work. I suspect there is a bug somewhere in your code. But
without seeing your code it impossible to know exactly where.
 
B

buu

I don't have big code (just a few lines).

But, if I have a photo 100x200 pixels, and I would like to read just first
40x50 pixels, what should be syntax for PixelGrabber?
 
T

Thomas Fritsch

buu said:
I don't have big code (just a few lines). Where? I don't see anything.

But, if I have a photo 100x200 pixels, and I would like to read just first
40x50 pixels, what should be syntax for PixelGrabber?
Carefully read the API docs at
<http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/PixelGrabber.html>
There is an example how to get all the pixels of an image. You have to
modify it for getting only the top-left 40x50 pixels of the image.
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top