hi
i need to get pixel value of an color image but i don`t know how.
i need code for do this.

Recommended Answers

All 3 Replies

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

You probably want a java.awt.image.BufferedImage. It has a method called getRGB which can give you the color of any pixel. If you have any other kind of java.awt.Image then you can start by constructing a BufferedImage of the same size. I'll call it bImage. Then you can call bImage.getGraphics() to allow you to draw your image onto bImage.

Don't forget to call dispose() on your graphics object, and be aware that not all Image objects are fully ready to be drawn. You may need to use an java.awt.image.ImageObserver or some other technique to wait for the image to be ready.

suggegtion only :

PixelGrabber is also another class where we can get image data in a pixel by pixel manner

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.