The following code is to convert a pic into grayscale image
So how am I supposed to draw back a normal image after turning it into grayscale image?
I used a way in which it will save the normal image before converting it into grayscale image....and after convertion, i press a button which will set back the previous normal image which was saved earlier. But due to some reason I don't want to use this method....i only want to draw back a normal image
GreenfootImage img=dan.getImage(); for(int i=0; i<=img.getWidth(); i++) { for(int j=0; j<=img.getHeight(); j++) { Color col=img.getColorAt(i,j); int r=col.getRed(); int g=col.getGreen(); int b=col.getBlue(); int avg=(r+g+b)/3; img setColorAt(i, j, new Color(avg, avg, avg); } dan.setImage(img); }