android - How to resize my bitmap as 16*16 size or 32*32 -
i want resize bitmap image icon size.i have written 1 function that.but zoomed out.but want make image width , height smaller.its not decremented after width , height.how can zoom down icon size ?
here function..
private bitmap getimagemap(file f){ try { //decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodestream(new fileinputstream(f),null,o); //the new size want scale final int required_size=80; //find correct scale value. should power of 2. int scale=1; while(o.outwidth/scale/2>=required_size && o.outheight/scale/2>=required_size) scale*=2; //decode insamplesize bitmapfactory.options o2 = new bitmapfactory.options(); o2.insamplesize=scale; return bitmapfactory.decodestream(new fileinputstream(f), null, o2); } catch (filenotfoundexception e) {} return null; }
this may helpful , easy,
bitmap bmp=bitmap.createscaledbitmap(yourbitmap, 32, 32, false);
Comments
Post a Comment