SimpleMobileTools / Simple-Gallery

A premium app for managing and editing your photos, videos, GIFs without ads
https://www.simplemobiletools.com
GNU General Public License v3.0
3.56k stars 759 forks source link

Image resize needs substantial improvement #1102

Open symsymsym1 opened 5 years ago

symsymsym1 commented 5 years ago

The app is awesome, but the resize feature probably uses nearest neighbor resampling algorithm. This leads to visible image quality degradation, especially on images with something like stripes or tiny checkerboards. Take a look at the original and the cropped\resized image: image image To avoid this, you'll need to use bilinear resampling either by setting last flag to True here: val resized = Bitmap.createScaledBitmap(bitmap, resizeWidth, resizeHeight, false) or, ideally, utilizing specialized library that can use separate algorithms for optimal resizing to larger and smaller sizes. Probably Glide could be useful?

tibbi commented 5 years ago

Im using https://github.com/ArthurHub/Android-Image-Cropper for that, check if they have something similar reported.

symsymsym1 commented 5 years ago

I see no similar reports on the cropper, however looking at its code, the root cause seems to be exactly as I've outlined above :) https://github.com/ArthurHub/Android-Image-Cropper/blob/master/cropper/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java line 425, 433: if (options == CropImageView.RequestSizeOptions.RESIZE_EXACT) { resized = Bitmap.createScaledBitmap(bitmap, reqWidth, reqHeight, false); } else {

tibbi commented 5 years ago

you might want to report it there, to see what does the creator have to say about it. It isnt really an active project anymore though.

hydrargyrum commented 4 years ago

I second that, "nearest" is really awful quality.

ValdikSS commented 2 years ago

@tibbi, any plans to improve the resizing? Unfortunately, this is the major drawback of the program — the text on resized screenshots looks very low quality.

hydrargyrum commented 2 years ago

It seems the upstream project is unmaintained, there are no replies on the related issue. It seems there are forks, one is mentioned on the issue, though it don't know if it's trustworthy.

OkyDooky commented 1 year ago

I cannot vouch for trustworthiness, but this fork is actively maintained/developed and has a guide on migrating to it from the old version: https://github.com/CanHub/Android-Image-Cropper The guide is on that page, a little lower down. I believe it would be beneficial to migrate to it, as this should take care of many existing and future bugs and issues. Investigating it further might be a good idea.