有人可以帮助您使用一些代码来创建Java中的TIFF缩略图。
使用此Post我为JPEG和PNG创建了缩略图。
答案 0 :(得分:0)
BufferedImage 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;
阅读ImageIO.read(aFile);总是返回null。