Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.image.BufferedImage;
- import java.io.File;
- import javax.imageio.ImageIO;
- public class App {
- public static void main(String[] args) {
- BufferedImage img = new BufferedImage(256, 256,
- BufferedImage.TYPE_INT_RGB);
- int r = (byte)255;
- int g = (byte)10;
- int b = (byte)50;
- int col = (r << 16) | (g << 8) | b;
- for(int i = 0; i < img.getWidth()/2; i++) {
- for(int j = 0; j < img.getHeight()/2; i++) {
- img.setRGB(i, j, col);
- }
- }
- File f = new File("test.png");
- try{
- ImageIO.write(img, "PNG", f);
- } catch(Exception e) {
- System.out.println("Failed");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement