Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionBufferedImage loc_img=new BufferedImage(322,322,BufferedImage.TYPE_INT_RGB); Graphics loc_g2d=loc_img.createGraphics(); //coloration du font en blanc loc_g2d.setColor(Color.WHITE); loc_g2d.fillRect(0,0,322,322); //dessin du diagramme my_paint(loc_g2d,par_Arbre,par_Niveau); //enregistrement du graphique en image jpg sur le disque File file; FileOutputStream out; try { file = new File("Impression", par_Niveau.replace('.','-')+".jpg"); out = new FileOutputStream(file); // To write the jpeg to a file uncomment the File* lines and // comment out the ByteArray*Stream lines. JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(loc_img); param.setQuality(1.0f, false); encoder.setJPEGEncodeParam(param); try { encoder.encode(loc_img); } catch (IOException par_e) {System.err.println(par_e.getMessage());} out.close(); } catch (IOException e){ return; }