1

Starting with KitKat, a Bitmap created from a .gif by a BitmapFactory has black pixels where transparent ones are expected. Here's the code:

// Set up the BitmapFactory options
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;

// Decode bitmap
b = BitmapFactory.decodeStream(c.getInputStream(), null, options);
                
Log.d(TAG, "hasAlpha=" + b.hasAlpha());
Log.d(TAG, "color=" + b.getPixel(1,1));

If I run this in JellyBean, LogCat shows:

hasAlpha=true

color=0

But in KitKat, LogCat shows:

hasAlpha=false

color=-16777216

(-16777216 = android.graphics.Color.BLACK)

So, how do I get KitKat to display these pixels as transparent?

Thanks!

Community
  • 1
  • 1
Hap
  • 556
  • 1
  • 6
  • 20

0 Answers0