Results 1 to 3 of 3
  1. #1
    carindia is offline Member
    Join Date
    Sep 2010
    Posts
    1
    Rep Power
    0

    Default How to read the pixel values of a jpg binary image

    Hi,I wanted to extract the pixel information of a 2d binary image (jpg format) using java in a 2d array?

    How is it possible to get the same? Since the image is binary, the array shall contain only 0s and 1s?

    Thanks for the help.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by carindia View Post
    Hi,I wanted to extract the pixel information of a 2d binary image (jpg format) using java in a 2d array?

    How is it possible to get the same? Since the image is binary, the array shall contain only 0s and 1s?

    Thanks for the help.
    Use the ImageIO class to read the .jpeg formatted file and produce a BufferedImage; you can do everything you want with the image afterwards (the API documentation is your friend here (as always)).

    kind regards,

    Jos

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default

    Since the image is binary, the array shall contain only 0s and 1s
    Everything in a computer is only 0s and 1s. We group 8 of them to get a byte, 32 of them for an in, 16 of them for a Unicode character, etc.
    When you read the bits/bytes of an image into a class object, you will be able to access individual bytes of the image and within that byte the individual bits.
    Some classes that allow you to look at pixels in an image store the data in int values referred to as ARGB format: top byte is Alpha/transparency, then bytes for Red, Green and Blue values.

Similar Threads

  1. Scanning Image Pixel by Pixel
    By the_transltr in forum Advanced Java
    Replies: 5
    Last Post: 08-28-2012, 04:01 PM
  2. problem with pixel values of an image
    By SreerajSarma in forum New To Java
    Replies: 6
    Last Post: 03-06-2010, 03:47 PM
  3. Identify pixel in the image.
    By Maiquelnet in forum Java 2D
    Replies: 2
    Last Post: 11-12-2009, 07:55 PM
  4. Replies: 14
    Last Post: 04-10-2009, 08:46 AM
  5. how to get rgb value each pixel of an image file
    By tOpach in forum New To Java
    Replies: 1
    Last Post: 03-28-2009, 04:38 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
  •