我尝试通过 Java 中的双三次算法调整字符图像的大小。但是正如您所看到的,它已链接,图像的连接性已损坏...我刚刚编写了代码..
public BufferedImage scaleImage(BufferedImage img, int width, int height,
Color background) {
BufferedImage newImage = new BufferedImage(width, height,
BufferedImage.TYPE_BYTE_BINARY);
Graphics2D g = newImage.createGraphics();
try {
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
//g.setBackground(background);
//g.setColor(Color.BLACK);
g.clearRect(0, 0, width, height);
g.drawImage(img, 0, 0, width, height, this);
} finally {
g.dispose();
}
return newImage;
}
我究竟做错了什么?