Skip to content

Instantly share code, notes, and snippets.

View sermojohn's full-sized avatar

Ioannis Sermetziadis sermojohn

  • ThousandEyes (part of Cisco)
  • Heraklion, Greece
  • X @sermojohn
View GitHub Profile
@sermojohn
sermojohn / gist:4632652
Created January 25, 2013 08:03
Utility method for generating an image with rounded corners from an image with proper corners.
public class ImageUtils {
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int radius, int bgcolor) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
final float roundPx = radius;