Code example for Bitmap

Methods: createScaledBitmapgetHeightgetWidth

0
			// may be larger than the thumbnail size if it is not a 1:1 aspect ratio. This is necessary to provide 
			// parity with iOS since the Android scale-to-fit options will scale the image so that both width and 
			// height fit within the specified rectangle, whereas the iOS scale-to-fit options will scale so that 
			// the smaller size fits the specified rectangle 
			 
			float scale = (image.getWidth() < image.getHeight()) ? (float)image.getWidth() / (float)size : (float)image.getHeight() / (float)size;
			int width = (int)(image.getWidth() / scale);
			int height = (int)(image.getHeight() / scale);
			Bitmap tempBitmap = Bitmap.createScaledBitmap(image, width, height, true);
			 
			// Create a new bitmap that is the thumbnail size 
			Bitmap resultBitmap = Bitmap.createBitmap(size + borderSize * 2, size + borderSize * 2, Bitmap.Config.ARGB_8888);
			Canvas canvas = new Canvas(resultBitmap);
			 
			// Create a clipping path with rounded corners 
			if (cornerRadius > 0) {
		        final Rect rect = new Rect(borderSize, borderSize, size + borderSize, size + borderSize);
		        final RectF rectF = new RectF(rect);
				Path path = new Path();
				path.addRoundRect(rectF, (float)cornerRadius, (float)cornerRadius, Path.Direction.CCW);
				canvas.clipPath(path);