1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| public static void main(String[] args)
{
try
{
URL url = new URL("***");
// L'image initiale
Image img = ImageIO.read(url);
// Le buffer sur lequel on va appliquer les modifications
BufferedImage bi = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi.createGraphics();
// On dessine l'image initiale
g2d.drawImage(img, 0, 0, 180, 96, null);
File out = new File("C:\\sortie.png");
ImageIO.write(bi, "png", out);
}
catch(Exception e)
{
System.out.print("Erreur : " + e.toString());
}
} |
Partager