You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the background transparent PNG is converted to BPG, it is converted to PNG by bpg_ decoder for preservation, and the transparent background becomes black
#7
Open
shaoguanglin opened this issue
Mar 23, 2020
· 0 comments
-----------use bpg_decoder get a bitmap:
public static Bitmap getDecodedBpgBitmap(Context context, File bpgFile) throws FileNotFoundException {
Bitmap bm = null;
try {
FileInputStream fis = new FileInputStream(bpgFile);
byte[] byteArray = toByteArray(fis);
byte[] decBuffer = null;
int decBufferSize = 0;
decBuffer = DecoderWrapper.decodeBuffer(byteArray, byteArray.length);
decBufferSize = decBuffer.length;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
options.inDither=false;
if (decBuffer != null) {
bm = BitmapFactory.decodeByteArray(decBuffer, 0, decBufferSize,options);
}
} catch (IOException ex) {
TLog.e("getDecodedBpgBitmap", "Failed to convert image to byte array");
}
return bm;
}
--------------and save the bitmap to PNG ,but the transparent background became to black.
bpgBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream)
The text was updated successfully, but these errors were encountered:
-----------use bpg_decoder get a bitmap:
public static Bitmap getDecodedBpgBitmap(Context context, File bpgFile) throws FileNotFoundException {
Bitmap bm = null;
try {
FileInputStream fis = new FileInputStream(bpgFile);
byte[] byteArray = toByteArray(fis);
byte[] decBuffer = null;
int decBufferSize = 0;
decBuffer = DecoderWrapper.decodeBuffer(byteArray, byteArray.length);
decBufferSize = decBuffer.length;
--------------and save the bitmap to PNG ,but the transparent background became to black.
bpgBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream)
The text was updated successfully, but these errors were encountered: