Results 1 to 4 of 4
  1. #1
    Deva is offline Member
    Join Date
    Dec 2009
    Posts
    6
    Rep Power
    0

    Default Code for image to binary

    Hi,

    Can any one post the code for converting the image into binary bits and binary bits into image which i ve to store in the array for manipulating those bits. Kindly post me the complete code or send the URL that contains the code.

    Regards,
    Deva.

  2. #2
    renamed is offline Member
    Join Date
    Dec 2009
    Location
    Rio de Janeiro
    Posts
    38
    Rep Power
    0

    Default

    This thread is duplicated.

    Image to Binary bits

    We usually help everybody. But it's not usual to give the complete code. JosAH sent to you the documentation needed to do what you want, please read it and you will be able to do it by yourself =)

    Rgs.
    Last edited by renamed; 12-22-2009 at 01:13 PM.
    Please don't laugh at my English... I'm trying my best! :)

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,440
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Deva View Post
    Hi,

    Can any one post the code for converting the image into binary bits and binary bits into image which i ve to store in the array for manipulating those bits. Kindly post me the complete code or send the URL that contains the code.

    Regards,
    Deva.
    We are not going to do your homework for you; I already answered your question in your other thread (don't start multiple threads for the same problem).

    kind regards,

    Jos

  4. #4
    raqman is offline Member
    Join Date
    Sep 2009
    Posts
    37
    Rep Power
    0

    Default

    I think you would have to create a PixelGrabber which returns an array of ints made from the image. Once you have that, I think you could use this method to convert the ints to binary:

    Integer.toBinaryString(int);

    Here is an example of a Pixel Grabber that creates a screen shot and throws it into an array of ints.

    private int[] capture() throws InterruptedException {
    dim = Toolkit.getDefaultToolkit().getScreenSize();
    Image tmp = robot.createScreenCapture(new Rectangle(dim.width,dim.height)).getScaledInstance
    (800,600,BufferedImage.SCALE_SMOOTH);
    int pix[] = new int[IMG_WIDTH*IMG_HEIGHT];
    PixelGrabber pg = new PixelGrabber
    (tmp,0,0,IMG_WIDTH,IMG_HEIGHT,pix,0,IMG_WIDTH);
    pg.grabPixels();
    return pix;
    }
    RAQ Report: free Java reporting tool.

Similar Threads

  1. Image to Binary bits
    By Deva in forum New To Java
    Replies: 4
    Last Post: 12-24-2009, 04:49 PM
  2. How save Image BMP Binary type?
    By shakall in forum SWT / JFace
    Replies: 3
    Last Post: 12-22-2009, 01:50 PM
  3. code for binary tree in jsp
    By ajay kumar in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-17-2009, 06:45 AM
  4. How to set the background of binary image?
    By hyz_zsu in forum Java 2D
    Replies: 1
    Last Post: 04-09-2009, 03:14 AM
  5. converting image to binary code n vice versa
    By nupurashi in forum Advanced Java
    Replies: 4
    Last Post: 04-01-2009, 07:27 PM

Posting Permissions

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