可能重复:
Can't read and write a TIFF image file using Java ImageIO standard library
有人可以帮助我们使用一些代码来创建Java中的TIFF缩略图。 使用此Post已创建JPEG和PNG缩略图。我使用下面的代码为PNG和JPEG
创建了thumbanailBufferedImage image = ImageIO.read(aFile);
BufferedImage thumbnNailImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = thumbnNailImage.createGraphics();
g2.fillRect(0, 0, width, height);
double xScale = (double) width / image.getWidth();
double yScale = (double) height / image.getHeight();
double scale = Math.min(xScale, yScale);
double x = (width - image.getWidth() * scale) / 2;
double y = (height - image.getHeight() * scale) / 2;
AffineTransform at = AffineTransform.getScaleInstance(x, y);
at.scale(scale, scale);
g2.drawRenderedImage(image, at);
g2.dispose();
return thumbnNailImage;