Java tutorial
//package com.java2s; import java.awt.Graphics2D; import java.awt.image.BufferedImage; public class Main { private static BufferedImage prepareImage(BufferedImage image, int shadowSize) { BufferedImage subject = new BufferedImage(image.getWidth() + shadowSize * 2, image.getHeight() + shadowSize * 2, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = subject.createGraphics(); g2.drawImage(image, null, shadowSize, shadowSize); g2.dispose(); return subject; } }