0

I have an image and am wondering how i remove the unnecessary background color in the image.

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);
}

would it be better to use a bufferedImage or ImageIcon?

nathannn
  • 1
  • 1
  • 1
  • Take a look at this answer: http://stackoverflow.com/questions/14097386/how-to-make-drawn-images-transparent-in-java – Lubo Oct 12 '14 at 07:30
  • BufferedImage would give you access to the image data directly. A pong image also has the capacity to support alpha based colors, perhaps you should edit the image to remove the background color yourself – MadProgrammer Oct 12 '14 at 08:57

0 Answers0