Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; public class Main { /** * Adds the white border to the specifed bitmap image using specified border size. * * @param bmp to add border * @param borderSize * @return bitmap image with border. */ public static Bitmap addWhiteBorder(Bitmap bmp, int borderSize, int imgSize) { 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; } }