문제

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?

올바른 솔루션이 없습니다

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top