System.out.println("dcraw value: " + m_error);
if (m_error > 0) {
of.delete();
throw new BadImageFileException(of);
}
if (!ofName.equals(of.getPath())) {
of.delete();
of = new File(ofName);
}
if (of.getName().endsWith(".jpg") || of.getName().endsWith(".tiff")) {
if (of.getName().endsWith(".jpg")) {
try {
LCJPEGReader jpegReader = new LCJPEGReader(of.getPath());
result = jpegReader.getImage();
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
LCTIFFReader tiffReader = new LCTIFFReader(of.getPath());
result = tiffReader.getImage(null);
} catch (Exception e) {
e.printStackTrace();
}
}
long t2 = System.currentTimeMillis();
int totalData = result.getWidth() *
result.getHeight() *
result.getColorModel().getNumColorComponents() *
(result.getColorModel().getTransferType() == DataBuffer.TYPE_BYTE ? 1 : 2);
System.out.println("Read " + totalData + " bytes in " + (t2 - t1) + "ms");
} else {
ImageData imageData;
try {
imageData = readPPM(of);
} catch (Exception e) {
e.printStackTrace();
throw new BadImageFileException(of, e);
}
// do not change the initial image geometry
// m_width = Math.min(m_width, imageData.width);
// m_height = Math.min(m_height, imageData.height);