答案 0 :(得分:1)
感谢所有的帮助:-) 改变转换功能后,问题解决了,不知道为什么会这样,gpasch可能是对的
public static BufferedImage transformImage(BufferedImage image, AffineTransform transform) throws Exception {
AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BICUBIC);
BufferedImage destinationImage = new BufferedImage(image.getWidth(),image.getHeight(), image.getType());
destinationImage = op.filter(image, destinationImage);
return destinationImage;
}
答案 1 :(得分:0)
这可以解决您的问题。根据AffineTransformOp
Thread.Sleep
因此我建议如下:
"If destCM is null, an appropriate ColorModel is used; this ColorModel may
have an alpha channel even if the source ColorModel is opaque."
甚至放弃兼容的图像:
AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BICUBIC);
BufferedImage destinationImage = op.createCompatibleDestImage(image, null );
destinationImage = op.filter(image, null);
return destinationImage;
此外,我不确定Bicubic是那么重要,但可能不是问题。
因为兼容图像返回带有alpha的图像,即透明
此
AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BICUBIC);
BufferedImage destinationImage = op.filter(image, null);
return destinationImage;
会在图像上放一层透明图案;之后绘制的图像与白色融合。
答案 2 :(得分:0)
保持简单,您应该使用操作期望的尺寸:
AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
BufferedImage destinationImage = op.filter(bImage, op.createCompatibleDestImage(bImage, null));