I have a problem here. I need to use some image for my project but when I set image in greenfoot, the image always appears with the white background. So what should I do to make the white background disappear.
thank you so much guys.
public GreenfootImage removeWhite(GreenfootImage image)
{
if (image == null) return null;
int width=image.getWidth(), height=image.getHeight();
GreenfootImage newImage = new GreenfootImage(width, height);
Color c=null, white=new Color(255, 255, 255);
for (int x=0; x<width; x++) for (int y=0; y<height; y++)
{
c = image.getColorAt(x, y);
if (!c.equals(white)) newImage.setColorAt(x, y, c);
}
return newImage;
}setImage(removeWhite(new GreenfootImage("your image name.png")));