mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-03 03:25:28 -04:00
No longer reads thumbnails, as part of the readWithOrientation method.
(cherry picked from commit 80c595cea83dd088946f7518ccbddbfb0e7b10b3)
This commit is contained in:
parent
2488f6f67c
commit
efe5f3c34a
@ -2,6 +2,7 @@ package com.twelvemonkeys.contrib.exif;
|
||||
|
||||
import com.twelvemonkeys.image.ImageUtil;
|
||||
import com.twelvemonkeys.imageio.ImageReaderBase;
|
||||
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.imageio.IIOImage;
|
||||
@ -82,12 +83,11 @@ public class EXIFUtilities {
|
||||
ImageReader reader = readers.next();
|
||||
try {
|
||||
reader.setInput(input, true, false);
|
||||
IIOImage image = reader.readAll(0, reader.getDefaultReadParam());
|
||||
|
||||
BufferedImage bufferedImage = ImageUtil.toBuffered(image.getRenderedImage());
|
||||
image.setRenderedImage(applyOrientation(bufferedImage, findImageOrientation(image.getMetadata()).value()));
|
||||
IIOMetadata metadata = reader.getImageMetadata(0);
|
||||
BufferedImage bufferedImage = applyOrientation(reader.read(0), findImageOrientation(metadata).value());
|
||||
|
||||
return image;
|
||||
return new IIOImage(bufferedImage, null, metadata);
|
||||
}
|
||||
finally {
|
||||
reader.dispose();
|
||||
@ -123,9 +123,15 @@ public class EXIFUtilities {
|
||||
for (String arg : args) {
|
||||
File input = new File(arg);
|
||||
|
||||
// Read everything (similar to ImageReader.readAll(0, null)), but applies the correct image orientation
|
||||
// Read everything but thumbnails (similar to ImageReader.readAll(0, null)),
|
||||
// and applies the correct image orientation
|
||||
IIOImage image = readWithOrientation(input);
|
||||
|
||||
if (image == null) {
|
||||
System.err.printf("No reader for %s%n", input);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Finds the orientation as defined by the javax_imageio_1.0 format
|
||||
Orientation orientation = findImageOrientation(image.getMetadata());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user