2017-12-06 1 views
1

작은 이미지처럼 작은 이미지로 이미지의 크기를 조정하고 싶습니다. 나는 다음과 같은 옵션 이미지 내용을 잃지 않고 이미지 크기를 조정하는 방법

Bitmap imageBitmap = Bitmap.createScaledBitmap(mBitmap, 200, 700, false); 

ThumbnailUtils.extractThumbnail() 

이러한 옵션의 두 이미지의 일부를 잘라을 사용했다. 그래서 그들은 좋아 보이지 않습니다. 난 그냥 이미지 크기를 줄이려면 이미지 내용을 잃고 싶지 않아요.

+1

가능한 복제처럼 시도해야 (https://stackoverflow.com [eficiently 및 안드로이드에 밖으로 잃고 품질 비트 맵의 ​​크기를 조정하는 방법]/questions/8327846/how-to-resize-a-bitmap-and-with-out-lose-with-android) – Redman

+0

https://stackoverflow.com/questions/47627727/cropping-image-by- 동적으로 높이 설정/47627812 # 47627812 –

+0

[중복 이미지 축소] 안드로이드에서 품질을 잃지 않고 크기] (https://stackoverflow.com/questions/28424942/decrease-image-size-without-losing-its-quality-in-android) – ADM

답변

0

품질을 떨어 뜨리지 않고 이미지의 크기를 조정하려면 이미지를 드로어 블/밉맵에서 가져 오려면 pngquant를 시도해야합니다.

https://pngquant.org/

+0

그는 프로그램으로하고 싶다. – Redman

1

당신이

public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) 
{ 
    int width = bm.getWidth(); 
    int height = bm.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(bm, 0, 0, width, height, matrix, false); 
    return resizedBitmap; 
} 
1
BitmapFactory.Options bmOptions = new BitmapFactory.Options(); 
    Bitmap bitmap = BitmapFactory.decodeFile(filepath,bmOptions); 

    //Part 1 :withcompression Sacle image 200 pixels x 700 pixels this size you can customize as per your requirement 

    Bitmap withCompressed = Bitmap.createScaledBitmap(bitmap,200,700,true); 
관련 문제