This site requires JavaScript, please enable it in your browser!
Greenfoot back
Kartoffelbrot
Kartoffelbrot wrote ...

2013/11/10

Orange images

Kartoffelbrot Kartoffelbrot

2013/11/10

#
I wrote a little program with greenfoot, that edits images. It only knows the colours: new Color(0,0,0,0) // transparent, to those, who didn't know Color.WHITE Color.BLACK The image, which is placed into the images folder of greenfoot is opened and used as a GreenfootImage. Then the program paints the dark pixels black, the bright pixels white nad the nearly transparent pixels transparent. Afterwards the image is saved into the images folder of greenfoot. A "_EDITED" is added to it's name. But now all pixels, that should be white are a kind of orange. In Greenfoot everything is ok and the images is white, where it should be, but the saved file has this curiosity. I used Busch's ImageSave, if anyone want's to know that.
bourne bourne

2013/11/10

#
I'm not familiar with Busch's ImageSave, But when I save a GreenfootImage I use the following and it has always worked (where gfImage is a GreenfootImage and png is file extension):
try
{
    String filename = "myNewImage"; // Name of file
    javax.imageio.ImageIO.write(gfImage.getAwtImage(), "png", new java.io.File("images/" + filename + ".png"));
}
catch (java.io.IOException ex)
{}
If this produces the same results, please show your code where you manipulate the GreenfootImage
Kartoffelbrot Kartoffelbrot

2013/11/11

#
That works fine. I saved the image as a jpg before. Maybe that's the problem. Thanks for your help. I got Busch's code from here Image Saver from Busch
You need to login to post a reply.