1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
BufferedImage t = new BufferedImage(100,100,BufferedImage.TYPE_BYTE_GRAY);
Graphics gs = t.getGraphics();
Rectangle rt = gs.getClipBounds();
gs.setClip(0, 0, 100, 100);
gs.setColor(Color.white);
gs.fillRect(0, 0, 100, 100);
gs.setColor(Color.black);
gs.drawString("CA MARCHE", 0, 50);
gs.drawLine(10, 10, 90, 90);
gs.dispose();
java.io.FileOutputStream fos = new java.io.FileOutputStream(args2);
TIFFEncodeParam tep = new TIFFEncodeParam();
tep.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
ImageEncoder ie = ImageCodec.createImageEncoder("tiff", fos,tep);
ie.encode(t);
fos.close(); |
Partager