mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 20:15:28 -04:00
JPEG Exif/thumbnail fixes pt II.
This commit is contained in:
parent
80c595cea8
commit
ea74ac2714
@ -62,6 +62,7 @@ import java.awt.color.ICC_ColorSpace;
|
|||||||
import java.awt.color.ICC_Profile;
|
import java.awt.color.ICC_Profile;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -1146,6 +1147,7 @@ public final class JPEGImageReader extends ImageReaderBase {
|
|||||||
if (jpegLength > 0 && jpegOffset + jpegLength <= stream.length()) {
|
if (jpegLength > 0 && jpegOffset + jpegLength <= stream.length()) {
|
||||||
// Verify first bytes are FFD8
|
// Verify first bytes are FFD8
|
||||||
stream.seek(jpegOffset);
|
stream.seek(jpegOffset);
|
||||||
|
stream.setByteOrder(ByteOrder.BIG_ENDIAN);
|
||||||
if (stream.readUnsignedShort() == JPEG.SOI) {
|
if (stream.readUnsignedShort() == JPEG.SOI) {
|
||||||
thumbnails.add(new EXIFThumbnailReader(thumbnailProgressDelegator, getThumbnailReader(), 0, thumbnails.size(), ifd1, stream));
|
thumbnails.add(new EXIFThumbnailReader(thumbnailProgressDelegator, getThumbnailReader(), 0, thumbnails.size(), ifd1, stream));
|
||||||
}
|
}
|
||||||
@ -1173,7 +1175,9 @@ public final class JPEGImageReader extends ImageReaderBase {
|
|||||||
// EXIFThumbnailReader?
|
// EXIFThumbnailReader?
|
||||||
thumbnails.add(new EXIFThumbnailReader(thumbnailProgressDelegator, getThumbnailReader(), 0, thumbnails.size(), ifd1, stream));
|
thumbnails.add(new EXIFThumbnailReader(thumbnailProgressDelegator, getThumbnailReader(), 0, thumbnails.size(), ifd1, stream));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
processWarningOccurred("EXIF IFD with empty or incomplete uncompressed thumbnail");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
processWarningOccurred("EXIF IFD with uncompressed thumbnail missing StripOffsets tag");
|
processWarningOccurred("EXIF IFD with uncompressed thumbnail missing StripOffsets tag");
|
||||||
@ -1230,7 +1234,15 @@ public final class JPEGImageReader extends ImageReaderBase {
|
|||||||
public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException {
|
public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException {
|
||||||
checkThumbnailBounds(imageIndex, thumbnailIndex);
|
checkThumbnailBounds(imageIndex, thumbnailIndex);
|
||||||
|
|
||||||
return thumbnails.get(thumbnailIndex).read();
|
// processThumbnailStarted(imageIndex, thumbnailIndex);
|
||||||
|
// processThumbnailProgress(0f);
|
||||||
|
|
||||||
|
BufferedImage thumbnail = thumbnails.get(thumbnailIndex).read();;
|
||||||
|
|
||||||
|
// processThumbnailProgress(100f);
|
||||||
|
// processThumbnailComplete();
|
||||||
|
|
||||||
|
return thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Metadata
|
// Metadata
|
||||||
|
Loading…
x
Reference in New Issue
Block a user