ImageIO read 16 bit unsigned short image

H

homecurr

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
 
R

Roedy Green

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top