所以我有一个 32 位深度的图像,但是当我将它变成我的 SQLite 数据库的 blob 并使用以下代码再次读取它时,它只有 24 位深度(质量较低,我希望它质量相同)。如何获得 32 位深度?:
DatabaseHandler db = new DatabaseHandler(camera.this);
List<Database> contacts = db.getAllContacts();
for (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 the blob back into a bitmap
byte[] blob = contact.getMP();
ByteArrayInputStream inputStream = new ByteArrayInputStream(blob);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
Bitmap scalen = Bitmap.createScaledBitmap(bitmap, 320, 240, false);
编码源是
Bitmap image15 = BitmapFactory.decodeResource(getResources(),R.drawable.wolverineklein);
// convert bitmap to byte
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image15.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte imageInByte1[] = stream.toByteArray();