我有这个问题。我使用此代码来旋转图像,但旋转的图像由于旋转而在其角落中具有黑色填充。 我怎样才能删除它?黑色填充图像在Java中?
public static BufferedImage rotate(BufferedImage img, int angle) {
rotate_checked = false;
int w = img.getWidth();
int h = img.getHeight();
BufferedImage dimg =new BufferedImage(w, h, BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g = dimg.createGraphics();
g.rotate(Math.toRadians(angle), w/2, h/2);
g.drawImage(img, null, 0, 0);
return dimg;
}
dup http://stackoverflow.com/questions/12799052/background-is-black-when-rotating-an-image –
“删除”你的意思是取代透明的alpha像素? – Vulcan