Wednesday, February 17, 2010

Thursday, February 4, 2010

import java.awt.image.BufferedImage
import java.awt.Graphics
import javax.imageio.ImageIO

def colorImage = ImageIO.read(new File(args[0]))

BufferedImage greyImage = new BufferedImage(1280, 853, BufferedImage.TYPE_BYTE_GRAY);
Graphics g = greyImage.getGraphics();
g.drawImage(colorImage, 0, 0, null);
g.dispose();

File file = new File("saved.png");
ImageIO.write(greyImage, "png", file);