Created
December 26, 2012 18:44
-
-
Save ignasi35/4382147 to your computer and use it in GitHub Desktop.
A sample GIST in response to https://twitter.com/sjimenezmateo/status/283907731214176256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.marimon.proof.image.manipulation; | |
import java.awt.Color; | |
import java.awt.Graphics2D; | |
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
import javax.imageio.ImageIO; | |
public class ImageReaderWriter { | |
public static void main(final String[] args) throws IOException { | |
BufferedImage read = | |
ImageIO.read(ImageReaderWriter.class | |
.getResourceAsStream("/cow.jpg")); | |
Graphics2D graphics = read.createGraphics(); | |
graphics.setColor(Color.RED); | |
graphics.drawRect(10, 10, 100, 100); | |
ImageIO.write(read, "png", new File("./target/out.png")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment