import java.awt.image.BufferedImage; import java.awt.Graphics2D;
public static BufferedImage grayscale(BufferedImage source){ BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TYPE_BYTE_GRAY); Graphics2D g2d = out.createGraphics(); g2d.drawImage(source, 0, 0, null); g2d.dispose(); return out; }
修改前
before
修改後
after
沒有留言 :
張貼留言