bazı belirtilen piksele Bitmap boyutunu azaltın ben 640px maksimum My Bitmap görüntü boyutunu küçültmek istiyorum. Mesela ben 1200 x 1200 px .. ben 640px bunu azaltabilir Nasıl boyutta Bitmap görüntü var. Bu yöntemAndroid
/** getResizedBitmap method is used to Resized the Image according to custom width and height
* @param image
* @param newHeight (new desired height)
* @param newWidth (new desired Width)
* @return image (new resized image)
* */
public static Bitmap getResizedBitmap(Bitmap image, int newHeight, int newWidth) {
int width = image.getWidth();
int height = image.getHeight();
float scaleWidth = ((float) newWidth)/width;
float scaleHeight = ((float) newHeight)/height;
// create a matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// recreate the new Bitmap
Bitmap resizedBitmap = Bitmap.createBitmap(image, 0, 0, width, height,
matrix, false);
return resizedBitmap;
}
teşekkür lvl API beri var. "(BitmapRatio> 1) ise" değil 0. yüksekliği daha büyük olsa bile, negatif bir orana sahip olmayacak, denetlemek zorundadır sert bir hata var. – ClemM
Bu çözümü her yerde görüyorum. Ama neden bitmapimi mahvediyor? Sadece üst kısımdan ayrıldım ve ekranın sağına da kaydırılmış ( – Sermilion