Code example for Bitmap

Methods: createScaledBitmapgetHeightgetWidth

	static ByteArrayOutputStream processPicture(Bitmap image) {
		// Compress JPEG PICTURE_COMPRESSION_QUALITY % quality and PICTURE_MIN_SIZE min size		 
		try { 
			ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
			Pair<Integer, Integer> desiredSize = resolveDesiredSize(image.getWidth(), image.getHeight());
			Bitmap resized = Bitmap.createScaledBitmap(image, desiredSize.first, desiredSize.second, false);
			resized.compress(CompressFormat.JPEG, Config.PICTURE_COMPRESSION_QUALITY, outputStream);
			return outputStream;
		} catch (IOException e) {
		return null; 
	 * Resolves the sample size nearest to the desired minimal size. 
Contextual code suggestions in your IDE  Get Codota for Java