commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Carpenter" <b...@engineer.com>
Subject RE: Blurry JPGs when using FileUpload 1.2.1
Date Sat, 14 Jun 2008 00:07:49 GMT
I didn't know that ImageIO reduces quality with each pass. ImageIO is used
at least twice for each file because it gets stored as a BLOB and is served
to clients by saving to disk then reading back in with ImageIO.

Thanks for the clue - I'll start looking down that path.

--BobC


-----Original Message-----
From: Emmanuel Bourg [mailto:ebourg@apache.org]
Sent: Friday, June 13, 2008 2:18 PM
To: Commons Users List
Subject: Re: Blurry JPGs when using FileUpload 1.2.1


You should write the uploaded image directly to the disk, you reduce its
quality every time your read and write it with ImageIO.

Emmanuel Bourg


Bob Carpenter a écrit :
> Hi,
>
> 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:
>
>   http://www.customerfeedbackllc.com/dev/receipt_before_upload.jpg
>   http://www.customerfeedbackllc.com/dev/receipt_after_upload.jpg
>
> 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 = ImageIO.read(is);
>
>   // 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,
> BufferedImage.TYPE_INT_BGR);
>   image.setRGB(0, 0, width, height, imgPix, 0, width);
>
>   // Write the bufi to a tmp file for viewing
>   ImageIO.write(bufiOut, "jpg", new
> File("c:\\tmp\\receipt_after_upload.jpg"));
>
> 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?
>
> Thanks,
>
> --BobC
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message