एंड्रॉइड में चित्र धुंधला - एंड्रॉइड

जब मैं गैलरी से मिलता हूं तो तस्वीर धुंधली दिखाई देती है। मैं निम्नलिखित कोड का उपयोग करके 250w * 300h आकार का हूं:

        if(bm!=null)
{
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
resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix,true);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}

इसे कैसे हल किया जा सकता है?।

उत्तर:

उत्तर № 1 के लिए 1

आपको केवल उपयोग में मैट्रिक्स हेरफेर की आवश्यकता नहीं है

resizedBitmap = Bitmap.createScaledBitmap(bm, w, h, true);

मुझे यकीन नहीं है कि आप newWidth और newHeight की गणना कैसे करते हैं, लेकिन यह हो सकता है कि आपका नया स्केल्ड बिटमैप बहुत छोटा हो और फिर एक दृश्य में स्ट्रीच हो इसलिए धुंधला हो जाता है।