SnappFr / react-native-image-base64

Simple react native library to convert an image to a base64 string 🌄
MIT License
49 stars 28 forks source link

may not support image png conversion base64 #4

Open MrZhang123 opened 6 years ago

MrZhang123 commented 6 years ago

I conversion .png to base64 , when i decoding base64 to png , the background is black

Michaelvilleneuve commented 6 years ago

That's possible, we mainly designed this lib to send camera pictures which are JPEG so we didn't focus on PNG.

I add it to the roadmap, in the meantime feel free to PR :)

Desintegrator commented 4 years ago

That's possible, we mainly designed this lib to send camera pictures which are JPEG so we didn't focus on PNG.

I add it to the roadmap, in the meantime feel free to PR :)

any news on it?

kirantripathi commented 4 years ago

@Desintegrator did you find any way to remove the dark background in image?

Desintegrator commented 4 years ago

@Desintegrator did you find any way to remove the dark background in image?

@kirantripathi yes, its works correctly in ios without any changes and for android you need to open RNImgToBase64Module.java in lib sources and change single line in "bitmapToBase64" method bitmap.compress(Bitmap.CompressFormat.JPEG, 80, byteArrayOutputStream); to bitmap.compress(Bitmap.CompressFormat.PNG, 80, byteArrayOutputStream);

kirantripathi commented 4 years ago

@Desintegrator did you find any way to remove the dark background in image?

@kirantripathi yes, its works correctly in ios without any changes and for android you need to open RNImgToBase64Module.java in lib sources and change single line in "bitmapToBase64" method bitmap.compress(Bitmap.CompressFormat.JPEG, 80, byteArrayOutputStream); to bitmap.compress(Bitmap.CompressFormat.PNG, 80, byteArrayOutputStream);

@Desintegrator thank you for your help.