我有一个图像,我想知道如何删除图像中不必要的背景颜色。
private Image img;
public Player() {
try {
ImageIcon i = new ImageIcon("imgs/player.png");
this.img = i.getImage();
} catch (Exception e) {
System.out.println("Exception: " + e);
}
}
public void draw(Graphics g) {
g.drawImage(img, 0, 0, null);
}
使用bufferedImage或ImageIcon会更好吗?