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
|