//Zoom Picture Public StaticBitmap zoomimg (String img,intNewwidth,intnewheight) {//Picture SourceBitmap BM =bitmapfactory.decodefile (IMG); if(NULL!=BM) { returnzoomimg (bm,newwidth,newheight); } return NULL;} Public StaticBitmap zoomimg (Context context,string img,intNewwidth,intnewheight) {//Picture SourceTry{Bitmap BM=Bitmapfactory.decodestream (Context.getassets (). Open (IMG));if(NULL!=BM) {returnzoomimg (BM, newwidth, newheight);}} Catch(IOException e) {//TODO auto-generated Catch blocke.printstacktrace ();}return NULL;}//Zoom Picture Public StaticBitmap zoomimg (Bitmap BM,intNewwidth,intnewheight) { //get the picture's width high intwidth =bm.getwidth (); intHeight =bm.getheight (); //Calculating the zoom ratio floatScaleWidth = ((float) newwidth)/width; floatScaleHeight = ((float) newheight)/height; //get the Matrix parameter you want to scaleMatrix Matrix =NewMatrix (); Matrix.postscale (ScaleWidth, ScaleHeight); //get a new pictureBitmap NEWBM = Bitmap.createbitmap (BM,0,0, width, height, matrix,true); returnNEWBM;}
Scale pictures like Android