Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; public class Main { public static Bitmap addWhiteBorder(Bitmap bmp, int borderSize) { Bitmap bmpWithBorder = Bitmap.createBitmap(bmp.getWidth() + borderSize * 2, bmp.getHeight() + borderSize * 2, bmp.getConfig()); Canvas canvas = new Canvas(bmpWithBorder); canvas.drawColor(Color.WHITE); canvas.drawBitmap(bmp, borderSize, borderSize, null); return bmpWithBorder; } }