Ich versuche, Bitmap-Größe mithilfe der Komprimierungsmethode zu reduzieren.Bitmap-Komprimierung ändert Bitmap-Byte-Größe nicht
Dies ist mein Code:
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;
}
Wenn ich meine Protokolle überprüfen i erhalten:
11-28 11:10:38.252: I/before compress(2429): 374544
11-28 11:10:38.262: I/after compress(2429): 374544
Warum ist die Kompresse nicht funktioniert?
UPDATE:
ich diesen Code versucht:
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;
}
immer noch die gleiche Byteanzahl
11-28 11:33:04.335: I/before compress(3472): 374544
11-28 11:33:04.395: I/after compress 2(3472): 374544
siehe Link follwing http://stackoverflow.com/questions/8417034/how-to-make-bitmap -compress-ohne-ändern-die-Bitmap-Größe – prakash
Es ist nicht mein Problem. Ich möchte meine Bitmap nicht skalieren, nur um die Größe im Speicher zu reduzieren, indem ich quilaty ändere. – dasdasd
Wurde für dieses Problem eine Lösung gefunden? Ich stehe hier genau dem gleichen Problem gegenüber. – Prateek