The code (from doGet( request, response) method):
====================================================
ImageIcon imgIcon = null;
Image img = null;
try {
imgIcon = new ImageIcon( jpegFile ); // this is the point at which memory swells to like 30mb.
}
catch ( Exception e )
{
e.printStackTrace();
response.sendError( HttpServletResponse.SC_NOT_FOUND, filename );
}
img = imgIcon.getImage();
imgIcon = null;
// Determine the scale. double scale = Math.min( (double) h / (double) img.getHeight( null ) , (double) w / (double) img.getWidth( null ) );
// Determine size of new image. int scaledW = (int)( scale * img.getWidth( null ) ); int scaledH = (int)( scale * img.getHeight( null ) );
BufferedImage thumb = new BufferedImage( scaledW, scaledH, BufferedImage.TYPE_INT_RGB );
// Set the scale. AffineTransform tx = new AffineTransform(); if ( scale < 1.0d ) tx.scale( scale, scale );
// Paint image. Graphics2D g2d = thumb.createGraphics(); g2d.drawImage( img, tx, null ); g2d.dispose(); g2d = null;
img.flush(); img = null;
OutputStream out = response.getOutputStream(); ImageIO.write( thumb, ext, out );
thumb.flush(); thumb = null; ====================================================
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]