1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-12 18:49:41 +01:00

save transparent PNG for stickers

This commit is contained in:
luvletter2333 2021-08-20 04:51:51 +08:00
parent 31a35ce721
commit 50ee1ecd98
No known key found for this signature in database
GPG Key ID: BFD68B892BECC1D8

View File

@ -20575,16 +20575,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!TextUtils.isEmpty(path)) {
try {
Bitmap image = BitmapFactory.decodeFile(path);
Bitmap outB = image.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(outB);
canvas.drawColor(Color.WHITE);
canvas.drawBitmap(image, 0, 0, null);
if (image != null) {
FileOutputStream stream = new FileOutputStream(path + ".png");
outB.compress(Bitmap.CompressFormat.PNG, 100, stream);
stream.close();
MediaController.saveFile(path + ".png", getParentActivity(), 0, null, null);
}
FileOutputStream stream = new FileOutputStream(path + ".png");
image.compress(Bitmap.CompressFormat.PNG, 100, stream);
stream.close();
MediaController.saveFile(path + ".png", getParentActivity(), 0, null, null);
} catch (Exception e) {
FileLog.e(e);
}