commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Carpenter" <>
Subject Blurry JPGs when using FileUpload 1.2.1
Date Fri, 13 Jun 2008 21:14:21 GMT

Using FileUpload 1.2.1 with Struts the image quality of my JPGs are blurry.
I've had this problem for a couple years, but was hoping that v1.2.1 would
solve the problem.

You can view the before and after images here:

Here is the code from my Struts Action class that does the work:

  String uploadFilePath = form.getUploadFilePath();
  InputStream is = uploadFile.getInputStream();  // uploadFile is a FormFile
  BufferedImage bufiIn =;

  // bufiIn is stored in a custom object (TransferImage, which extends
Canvas and is Serializable) - here are the essential steps
  int[] imgPix = (int[])pix;
  int width = bufiIn.getWidth();
  int height = bufiIn.getHeight();

  BufferedImage bufiOut = new BufferedImage(width, height,
  image.setRGB(0, 0, width, height, imgPix, 0, width);

  // Write the bufi to a tmp file for viewing
  ImageIO.write(bufiOut, "jpg", new

The receipt_before_upload.jpg comes from a camera phone. Usually, images
coming from scanners are not as blurry.

Can you suggest any way to reduce the blurriness?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message