-----------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)