android - Resizing Bitmap after Loading it with Universal Image Loader -
i loading image universal image loader, , i'd scale width width of screen , height scaled accordingly, meaning before load image know width want, not height. when load image want height , width of image , utilize scale according width of screen. code utilize this:
try { display.getsize(size); scaledwidth = size.x; } grab (java.lang.nosuchmethoderror ignore) { scaledwidth = display.getwidth(); } string filepath = "file://" + getbasecontext().getfilesdir().getpath().tostring() + "/" + imagepath + ".png"; bitmap bitmap = imageloader.loadimagesync(filepath); int height = bitmap.getheight(); int width = bitmap.getwidth(); scaledheight = (int) (((scaledwidth * 1.0) / width) * height); //code resize bitmap using scaledwidth , scaledheight
what's best way resize bitmap using universal image loader, or better, there way can specify width , bitmap scaled based on it's proportions?
you needn't yourself. consider using imagescaletype.exactly
new displayimageoptions.builder().imagescaletype(imagescaletype.exactly)
https://github.com/nostra13/android-universal-image-loader/blob/master/library/src/com/nostra13/universalimageloader/core/assist/imagescaletype.java
android bitmap universal-image-loader
No comments:
Post a Comment