Open amigax opened 7 years ago
Hi Gareth,
Depends on what you mean by ".raw".
I've started working on support for camera RAW formats, like Canon CR2, Nikon NEF and Adobe DNG, some time ago. It's in a separate branch, but I haven't had time to finish them yet. They can be used for extracting thumbnails and preview images, but no support for decoding, normalisation and demosaicing etc. of the RAW data yet.
For "pixel dump" type RAW files, you can use JAI ImageIO I think. Adding support for reading this is quite trivial, but you would need to to supply dimensions, pixel layout, bit depth etc., as these things are not stored in the file. So I'm not sure how useful it would be. No plans to add this.
What exactly are your requirements?
-- Harald K
At that point, in my branch ckovorodkin:camera-raw-cr2-slice
there is ability to decode "regular" Canon CR2 RAW as mixed one-channel grayscale bitmap.
Todo:
Please note, that the current implementation suggests TIFFImageReader
for processing the CR2 file (this is due to the fact that CR2 is based on TIFF). But TIFFImageReader
is unable to decode CR2 in correct way and must be rejected from list of readers:
final BufferedImage sourceImage;
try (final ImageInputStream stream = ImageIO.createImageInputStream(new File(parent, name))) {
final Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(stream);
ImageReader reader;
// skip TIFFImageReader
//noinspection StatementWithEmptyBody
while (!((reader = imageReaders.next()) instanceof CR2ImageReader)) {
}
final ImageReadParam param = reader.getDefaultReadParam();
reader.setInput(stream, false, false);
try {
sourceImage = reader.read(2, param);
} finally {
reader.dispose();
}
}
Sorry couldnt work out how to email author, will there be .raw support ever added?