Question

I use the following statement to copy an image from the assets to the gallery app, which works fine:

MediaStore.Images.Media.insertImage(getContentResolver(), myBitmap, myTitle ,  myDescription);

The images are png-files with a transparent background. They are displayed correctly when I load them from the assets to, for example an ImageView.

The problem is, that the formerly transparent background of the imported images became solid black in the gallery.

The png is a png24 created by gimp. I also tried a transparent gif and a png with transparency added by Apple's preview application with the same result.

Why it happens?

No correct solution

OTHER TIPS

I know this is an old question but I just had the same problem. The problem is that MediaStore.Images.Media.insertImage stores the file with a MIME_TYPE of "image/jpeg", and jpeg doesn't support transparency.

One solution is to make your own content provider that uses another image format. The Picasso image library might be worth a look too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top