android - inSampleSize vs createScaledBitmap? -


afaik, insamplesize attribute of bitmapfactory.options read sampled image per insamplesize value. eg: if value 4, read 1/16 pixels , memory required load drastically reduce. here in fact, maintaining aspect ratio in sense has skipped 1/4th pixels along height , 1/4th pixels along width. when load bitmap in smaller imageview, aspect ratio maintained , looks good. have used following formula derive insamplesize = max(width/reqwidth, height/reqheight)
size of imageview = 100dp * 100dp, have converted 100dp pixels per screen density , used result reqwidth , reqheight. (note: images bigger reqwidth , reqheight)

however if apply operation bitmap.createscaledbitmap() on above reduced version of bitmap, image gets stretched , not in view.

i not able understand createscaledbitmap() does?

given bitmap, let's call bmp1, create scaled bitmap method creates new bitmap bmp1 upscaled/downscaled new size.

however, since you're doing scaling yourself, perhaps should call createbitmap() instead? 1 respect new size tell be, , won't scale original image, want understood.

please correct me if i'm wrong, however.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -