Results 1 to 2 of 2
  1. #1
    xperia2995 is offline Member
    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0

    Question Display pixel value

    I'm planning of loading a black and white 10X10 gif
    then I want to print value of each pixel (like black 1; white 0)
    I have coded till this much. after grabbing the pixels using my object called pixelGrabber,
    I read in oracle that the method grabPixels() returns only an object. which class's object is it returning?
    how can I print each pixels' data?

    Please do help.
    I am new in java I cant understand very complex stuff.

    public static void main(String args[])throws Exception
    {
    BufferedImage img;
    img = ImageIO.read(new File("abc.gif"));
    int Width = img.getWidth();
    int Height = img.getHeight();
    PixelGrabber pixelGrabber=new PixelGrabber(img,0,0,Width,Height,false);
    pixelGrabber.grabPixels();
    }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,025
    Rep Power
    6

    Default Re: Display pixel value

    There is no need to use pixel grabber. BufferedImage has a method - getRGB() which returns an RGB int value of the pixel at the supplied coordinates. You can use the Color methods to interrogate the returned int value.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Scanning Image Pixel by Pixel
    By the_transltr in forum Advanced Java
    Replies: 5
    Last Post: 08-28-2012, 05:01 PM
  2. can you ask the color of one pixel?
    By liluma in forum New To Java
    Replies: 7
    Last Post: 09-06-2011, 08:53 PM
  3. Pixel Data..
    By programmer_007 in forum Java 2D
    Replies: 3
    Last Post: 03-03-2010, 11:39 PM
  4. compare two images pixel by pixel
    By java_bond in forum Advanced Java
    Replies: 6
    Last Post: 03-02-2010, 12:27 PM
  5. Pixel Array?
    By AndrewM16921 in forum New To Java
    Replies: 4
    Last Post: 04-03-2009, 01:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •