Simple-Gallery icon indicating copy to clipboard operation
Simple-Gallery copied to clipboard

Image resize needs substantial improvement

Open symsymsym1 opened this issue 5 years ago • 6 comments

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?

symsymsym1 avatar Nov 24 '18 14:11 symsymsym1

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

tibbi avatar Nov 24 '18 14:11 tibbi

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 {

symsymsym1 avatar Nov 24 '18 19:11 symsymsym1

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.

tibbi avatar Nov 30 '18 22:11 tibbi

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

hydrargyrum avatar Jul 19 '20 11:07 hydrargyrum

@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.

ValdikSS avatar Jul 17 '22 09:07 ValdikSS

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.

hydrargyrum avatar Jul 17 '22 10:07 hydrargyrum

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.

OkyDooky avatar Nov 16 '22 19:11 OkyDooky