mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 12:35:29 -04:00
PSD Thumbnail fix.
This commit is contained in:
parent
fe379df36e
commit
f14159de57
@ -1207,6 +1207,10 @@ public final class PSDImageReader extends ImageReaderBase {
|
|||||||
private List<PSDThumbnail> getThumbnailResources(final int imageIndex) throws IOException {
|
private List<PSDThumbnail> getThumbnailResources(final int imageIndex) throws IOException {
|
||||||
checkBounds(imageIndex);
|
checkBounds(imageIndex);
|
||||||
|
|
||||||
|
if (imageIndex > 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
readHeader();
|
readHeader();
|
||||||
|
|
||||||
List<PSDThumbnail> thumbnails = null;
|
List<PSDThumbnail> thumbnails = null;
|
||||||
@ -1240,7 +1244,7 @@ public final class PSDImageReader extends ImageReaderBase {
|
|||||||
List<PSDThumbnail> thumbnails = getThumbnailResources(imageIndex);
|
List<PSDThumbnail> thumbnails = getThumbnailResources(imageIndex);
|
||||||
|
|
||||||
if (thumbnails == null) {
|
if (thumbnails == null) {
|
||||||
throw new IndexOutOfBoundsException(String.format("thumbnail index %d > 0", thumbnailIndex));
|
throw new IndexOutOfBoundsException(String.format("image index %d > 0", imageIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
return thumbnails.get(thumbnailIndex);
|
return thumbnails.get(thumbnailIndex);
|
||||||
@ -1258,7 +1262,6 @@ public final class PSDImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BufferedImage readThumbnail(final int imageIndex, final int thumbnailIndex) throws IOException {
|
public BufferedImage readThumbnail(final int imageIndex, final int thumbnailIndex) throws IOException {
|
||||||
// TODO: Thumbnail progress listeners...
|
|
||||||
PSDThumbnail thumbnail = getThumbnailResource(imageIndex, thumbnailIndex);
|
PSDThumbnail thumbnail = getThumbnailResource(imageIndex, thumbnailIndex);
|
||||||
|
|
||||||
// TODO: It's possible to attach listeners to the ImageIO reader delegate... But do we really care?
|
// TODO: It's possible to attach listeners to the ImageIO reader delegate... But do we really care?
|
||||||
|
@ -2397,7 +2397,7 @@ public final class TIFFImageReader extends ImageReaderBase {
|
|||||||
// // System.err.println("Scale time: " + (System.currentTimeMillis() - start) + " ms");
|
// // System.err.println("Scale time: " + (System.currentTimeMillis() - start) + " ms");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (image.getType() == BufferedImage.TYPE_CUSTOM) {
|
if (image != null && image.getType() == BufferedImage.TYPE_CUSTOM) {
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
image = new ColorConvertOp(null).filter(image, new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB));
|
image = new ColorConvertOp(null).filter(image, new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB));
|
||||||
System.err.println("Conversion time: " + (System.currentTimeMillis() - start) + " ms");
|
System.err.println("Conversion time: " + (System.currentTimeMillis() - start) + " ms");
|
||||||
@ -2406,7 +2406,7 @@ public final class TIFFImageReader extends ImageReaderBase {
|
|||||||
showIt(image, String.format("Image: %s [%d x %d]", file.getName(), reader.getWidth(imageNo), reader.getHeight(imageNo)));
|
showIt(image, String.format("Image: %s [%d x %d]", file.getName(), reader.getWidth(imageNo), reader.getHeight(imageNo)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int numThumbnails = reader.getNumThumbnails(0);
|
int numThumbnails = reader.getNumThumbnails(imageNo);
|
||||||
for (int thumbnailNo = 0; thumbnailNo < numThumbnails; thumbnailNo++) {
|
for (int thumbnailNo = 0; thumbnailNo < numThumbnails; thumbnailNo++) {
|
||||||
BufferedImage thumbnail = reader.readThumbnail(imageNo, thumbnailNo);
|
BufferedImage thumbnail = reader.readThumbnail(imageNo, thumbnailNo);
|
||||||
// System.err.println("thumbnail: " + thumbnail);
|
// System.err.println("thumbnail: " + thumbnail);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user