Results 1 to 7 of 7
  1. #1
    stegano is offline Member
    Join Date
    Feb 2011
    Posts
    28
    Rep Power
    0

    Default retrieving/uploading image

    hi programmers...
    i have one question..
    how do we upload or retrieve image from disk?
    no need to be so user friendly, hardcoded also will do..
    i'm still a noob, so please tell me the easiest and simplest one...
    thank u in advance...

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

  3. #3
    Fortu is offline Member
    Join Date
    Dec 2010
    Posts
    57
    Rep Power
    0

    Default

    I usually use an ImageIcon (javax.swing) and Image (java.awt) to get an image into my program:

    Java Code:
    ImageIcon ii = new ImageIcon(this.getClass().getResource("mypicture.png"));
    Image image = ii.getImage();
    Note: Your image must be in the same directory as your .class file if you want this to work, otherwise you'll just get a nullPointerException I believe

  4. #4
    stegano is offline Member
    Join Date
    Feb 2011
    Posts
    28
    Rep Power
    0

    Default

    i have successfully read the image and display it,
    thanks to you and other good people. =)

    For now i don't want to display the image first but i want to display the image as the binary bits. In other words, i want to convert it to binary. If you have the solution please help me..
    Last edited by stegano; 03-31-2011 at 04:09 PM.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default

    Into what?

    db

    edit Next time I'll remember to quote the part of the post I'm referring to, so my remarks don't look irrelevant due the the referred part being edited out, 13 minutes later, without acknowledgement.
    Last edited by DarrylBurke; 04-07-2011 at 07:12 AM. Reason: Previous post was edited

  6. #6
    stegano is offline Member
    Join Date
    Feb 2011
    Posts
    28
    Rep Power
    0

    Default

    image eg. png or jpg image to be converted into 8bit binary representation.

  7. #7
    Fortu is offline Member
    Join Date
    Dec 2010
    Posts
    57
    Rep Power
    0

    Default

    Hmmmm, well, what you can do is use a byte (or byte array), and then load each byte into that byte (byte array) byte by byte, and display each byte's bits.. somehow. The byte will probably come out in decimal, so you'll also have to write code to convert decimal to binary (Not tough. I did decimal to hexadecimal on my TI-84 calc with the built in BASIC :D)

Similar Threads

  1. Uploading a image to a database via swing
    By hacker9116 in forum JDBC
    Replies: 3
    Last Post: 03-29-2011, 12:35 PM
  2. Retrieving image stored as BLOB object in oracle
    By venkateshcoolmoon in forum JDBC
    Replies: 11
    Last Post: 01-17-2010, 07:06 PM
  3. Uploading in an ftp applet help
    By d4dirty in forum Java Applets
    Replies: 0
    Last Post: 01-07-2010, 10:24 AM
  4. image uploading and retrieval in jframe
    By deepesh in forum AWT / Swing
    Replies: 3
    Last Post: 07-25-2009, 06:33 PM
  5. Uploading image using JSP
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-11-2008, 10:16 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
  •