मैं संपीड़न विधि का उपयोग कर बिटमैप आकार को कम करने की कोशिश कर रहा हूं।बिटमैप संपीड़न बिटमैप बाइट आकार बदल नहीं रहा
यह मेरा कोड है:
public Bitmap compressImage(Bitmap image) {
Bitmap immagex = image;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Log.i("before compress", immagex.getByteCount()+"");
boolean compress = immagex.compress(Bitmap.CompressFormat.JPEG, 10, baos);
if(compress)
Log.i("after compress", immagex.getByteCount()+"");
else
Log.i("bad compress", "bad compress");
return immagex;
}
जब मैं अपने लॉग मैं प्राप्त की जाँच करें:
11-28 11:10:38.252: I/before compress(2429): 374544
11-28 11:10:38.262: I/after compress(2429): 374544
संपीड़ित क्यों काम नहीं करता है?
अद्यतन:
मैं इस कोड की कोशिश की:
public Bitmap compressImage(Bitmap image) {
Bitmap immagex = image;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Log.i("before compress", immagex.getByteCount()+"");
boolean compress = immagex.compress(Bitmap.CompressFormat.JPEG, 10, baos);
Log.i("after compress 2", decodeSampledBitmapFromByte(image.getWidth(), image.getHeight(), baos.toByteArray()).getByteCount()+"");
return immagex;
}
फिर भी एक ही बाइट गिनती
11-28 11:33:04.335: I/before compress(3472): 374544
11-28 11:33:04.395: I/after compress 2(3472): 374544
कृपया लिंक follwing उल्लेख http://stackoverflow.com/questions/8417034/how-to-make-bitmap -compress-without-change-the-bitmap-size – prakash
यह मेरा मुद्दा नहीं है। मैं अपने बिटमैप को स्केल करने के लिए बस स्केल करने के लिए स्मृति में आकार को कम करने के लिए स्केल करना नहीं चाहता हूं। – dasdasd
इस समस्या के लिए एक समाधान मिला था? मुझे यहां एक ही मुद्दे का सामना करना पड़ रहा है। – Prateek