android - JPEG compress same size as original -


i'm stuck issue since 2 days : want compress bitmap (jpeg).

i found useful information here , on google none work fine.

my jpeg file in assets. can read without problem, retrieve info. when compress it, byte[] array fine, decodebytearray, size same original.

here code

inputstream in = assets.open(filename);   config config = bitmap.config.rgb_565; options options = new options();  options.inpreferredconfig = config;  bitmap bitmap = bitmapfactory.decodestream(in, null, options);  bytearrayoutputstream out = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.jpeg, 50, out); bitmap  = bitmapfactory.decodestream(new bytearrayinputstream(out.tobytearray()),null,options); 

i don't know do. thank in advance time

decoding reverse of compression: turns raw pixel data. compression useful reducing file size storage , transmission, when image gets displayed, gets decompressed in memory same size when started.

if want make raw pixel data smaller, need reduce resolution. imgscalr library here: produces results.

(but i'm not sure you're trying achieve.)


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -