Skip to content

Instantly share code, notes, and snippets.

@kyze8439690
Created November 11, 2013 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyze8439690/7408999 to your computer and use it in GitHub Desktop.
Save kyze8439690/7408999 to your computer and use it in GitHub Desktop.
fix android 2.3 can't decode bitmap in rgba8888 format
public static Bitmap convert(Bitmap bitmap, Bitmap.Config config) {
Bitmap convertedBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), config);
Canvas canvas = new Canvas(convertedBitmap);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
canvas.drawBitmap(bitmap, 0, 0, paint);
return convertedBitmap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment