10/01/03 17:01:27
public static void main(String[] args) throws Exception {
BufferedImage im = new BufferedImage(1920*2,1200*2,
BufferedImage.TYPE_INT_RGB);
Graphics2D g = im.createGraphics();
for (int x=0; x<im.getWidth(); x+=10) {
for (int y=0; y<im.getHeight(); y+=10) {
Color c = new Color((int)(Math.random()*256)
,(int)(Math.random()*256)
,(int)(Math.random()*256));
g.setColor(c);
g.drawLine(0, 0, x, y);
}
}
g.dispose();
OutputStream out = new FileOutputStream("test.jpg");
ImageOutputStream ios =
ImageIO.createImageOutputStream(out);
ImageWriter iw = (ImageWriter)ImageIO
.getImageWritersByFormatName("jpeg").next();
iw.setOutput(ios);
iw.write(im);
out.close();
}
これとか問題出る?