Code example for Bitmap

Methods: createBitmapgetHeightgetWidth

0
		h = ratio * h;
		return Bitmap.createScaledBitmap(bm, (int) w, (int) h, true);
	} 
 
	public static Bitmap getSquare(Bitmap bm) {
		int w = bm.getWidth();
		int h = bm.getHeight();
		int side = (w > h) ? h : w;
		return Bitmap.createBitmap(bm, 0, 0, side, side);
	} 
 
	public static Bitmap getRounded(Bitmap bm, int cornerRadiusPx) {
		int w = bm.getWidth();
		int h = bm.getHeight();
 
		Bitmap bmOut = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
		Canvas canvas = new Canvas(bmOut);
 
		Paint paint = new Paint();
		paint.setAntiAlias(true);
		paint.setColor(0xff424242);