ImageIO read 16 bit unsigned short image

Discussion in 'Java' started by homecurr@yahoo.com, Apr 18, 2004.

  1. Guest

    I use ImageIO to read a 16 bits tiff image. Here is my code:
    File file = new File(filename);
    BufferedImage image = ImageIO.read(file);
    DataBuffer data = image.getData().getDataBuffer();

    The type of "data" is unsigned short, but since java does not have
    unsigned, it is saved as short in data. I found that the number inside
    "data" is not right. It does not match what I read with other tools.

    Could anyone help me? Do I need something before read the image?

    Thanks,

    John crom CA
    , Apr 18, 2004
    #1
    1. Advertising

  2. Roedy Green Guest

    On 17 Apr 2004 16:45:23 -0700, wrote or quoted :

    >use ImageIO to read a 16 bits tiff image. Here is my code:
    > File file = new File(filename);
    > BufferedImage image = ImageIO.read(file);
    > DataBuffer data = image.getData().getDataBuffer();


    Wouldn't ImageIO work by looking at the signature of the file?
    IIRC it only supports a few formats, gif, jpg, png. I don't think
    tiff is among them. In any case tiff is actually dozens of slightly
    different formats.

    You might do better to bulk convert you images with something like
    Paint Shop Pro first.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Apr 18, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. F C
    Replies:
    2
    Views:
    5,130
  2. Davidski
    Replies:
    0
    Views:
    3,867
    Davidski
    Nov 5, 2004
  3. Replies:
    4
    Views:
    798
    Kaz Kylheku
    Oct 17, 2006
  4. Ioannis Vranos

    unsigned short, short literals

    Ioannis Vranos, Mar 4, 2008, in forum: C Programming
    Replies:
    5
    Views:
    657
    Eric Sosman
    Mar 5, 2008
  5. Replies:
    3
    Views:
    403
    James Kanze
    Nov 19, 2008
Loading...

Share This Page