thumbnailator icon indicating copy to clipboard operation
thumbnailator copied to clipboard

Image smoothness is lost for JPG images

Open jforjava1981 opened this issue 10 years ago • 2 comments
trafficstars

Hi,

My application saves images uploaded through iPAD app on server.

  1. 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).
  2. 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? original thumbnailtor converted

jforjava1981 avatar Sep 23 '15 18:09 jforjava1981

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

jforjava1981 avatar Nov 10 '16 20:11 jforjava1981

@coobird Any updates on this?

jforjava1981 avatar Apr 13 '17 10:04 jforjava1981