thumbnailator
thumbnailator copied to clipboard
Image smoothness is lost for JPG images
Hi,
My application saves images uploaded through iPAD app on server.
- iPAD app sends me Base64 encoded String. I decode it and get the byte array which I directly write to file. This introduces an issue of rotation where images are saved upside down(rotated 180 degree).
- I create a thumbnail from the file I saved above with following code and the rotation issue disappears and thubnail is saved in the correct way as it was captured.
Thumbnails.of(is)
.forceSize(200, 150)
.outputQuality(0.8)
.outputFormat(PricerConstants.PRICER_FILE_TYPE_JPG)
.toFile(thumbnailFilePath);
where "is" is inputstream for the image saved in step 1) 3) Now to resolve the rotation(upside down) issue with original image I tried following :
Thumbnails.of(new ByteArrayInputStream(data))
.rendering(Rendering.QUALITY)
.scale(1.0)
.outputQuality(1.0)
.outputFormat(PricerConstants.PRICER_FILE_TYPE_JPG)
.toFile(itemImageFile);
where data is byte array I receive after I Base64 decode the image. So basically I want save the image keeping all its qualities as it is including size but avoid roation issue I face and I achieve that. However I losing the quality of image in that I have lot of edges in my images where as original image is much smoother. The difference I found when I checked original image properties and converted image(step 3_ properties on windows are as follows:
Horizontal Resolution : 72 dpi(O) - 96 dpi(TC3) Vertical Resolution : 72 dpi(O) - 96 dpi(TC3)
Color Representation : sRGB(O) - no value(TC3) Resolution Unit : 2 (O) - no value(TC3)
where O - is original image value and TC3 - is image value using Thumbnailtor Converted in step 3 above.
Please find attached images to know the exact difference in smoothness.
Can you please help what might be causing this issue?

@coobird Hey Chris, Did you get chance to have a look at this?
@coobird Any updates on this?