Hi, I have a problem with following code : For big files, commands after " new IConversion(srcFile_tConvImg_1, desFile_tConvImg_1, IConversion.IMAGE_TYPE_JPEG);"
are executed before the file be created (i think it's caused by write command ) . I need that job wait before execute this commands. How can i do this ( i don't want a loop which test file existence). Thanks. final class IConversion { public final static String IMAGE_TYPE_JPEG = "JPEG"; public IConversion(java.io.File fichierSource, java.io.File fichierDestination, String compressionType) { // buffer java.awt.image.BufferedImage buf = null; java.awt.image.BufferedImage bufFinal = null; // Load try { buf = javax.imageio.ImageIO.read(fichierSource); } catch (java.io.IOException ex) { System.out.println("erreur"); } // Create buffer final bufFinal = new java.awt.image.BufferedImage(buf.getWidth(), buf.getHeight(),java.awt.image.BufferedImage.TYPE_INT_RGB); // Resize ? java.awt.Graphics2D g = (java.awt.Graphics2D) bufFinal .getGraphics(); g .setRenderingHint( java.awt.RenderingHints.KEY_INTERPOLATION, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(buf, 0, 0, buf.getWidth(), buf.getHeight(), null); g.dispose(); // Write dest file try { javax.imageio.ImageIO.write(bufFinal, compressionType, fichierDestination); } catch (java.io.IOException e) { e.printStackTrace(); } } } class Prog { public static void main (String[] args){ java.io.File srcFile_tConvImg_1 = new java.io.File( "c:/temp/test1.bmp"); java.io.File desFile_tConvImg_1 = new java.io.File("c:/temp/img/test2.jpeg"); // CONVERSION DU FICHIER System.out.println("begin"); new IConversion(srcFile_tConvImg_1, desFile_tConvImg_1, IConversion.IMAGE_TYPE_JPEG); System.out.println("end"); //other commands ... // END } } [Message sent by forum member 'badabeu42' (badabeu42)] http://forums.java.net/jive/thread.jspa?messageID=290551 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".