java - Change bit depth from Bitmap -
so have image 32 bit depth, when make blob sqlite database, , read out again following code has 24 bit depth (the quality lower, want same quality). how 32 bit depth? :
databasehandler db = new databasehandler(camera.this); list<database> contacts = db.getallcontacts(); (database contact : contacts) { bitmapfactory.options bmpfactoryoptions = new bitmapfactory.options(); bmpfactoryoptions.inpreferredconfig = bitmap.config.argb_8888; //bmpfactoryoptions.inscaled = false; bmpfactoryoptions.outheight = 240; bmpfactoryoptions.outwidth = 320; // decodes blob bitmap byte[] blob = contact.getmp(); bytearrayinputstream inputstream = new bytearrayinputstream(blob); bitmap bitmap = bitmapfactory.decodestream(inputstream); bitmap scalen = bitmap.createscaledbitmap(bitmap, 320, 240, false);
the encode source is
bitmap image15 = bitmapfactory.decoderesource(getresources(),r.drawable.wolverineklein); // convert bitmap byte bytearrayoutputstream stream = new bytearrayoutputstream(); image15.compress(bitmap.compressformat.jpeg, 100, stream); byte imageinbyte1[] = stream.tobytearray();
there no such thing 24 bits depth on android. bitmap can either be, 8 bits (alpha 8 format translucency or null config paletted formats), 16 bits (565 rgb format without translucency or 4444 rgba format translucency) or 32 bits (8888 rgba format translucency.)
update: means don't have alpha channel. colors encoded using 24 bits in both cases.
Comments
Post a Comment