I have an image of size w by h. In Java, I need to create an image that is size w by h+20 where the top w by
This is possible, you need to investigate BufferedImage and Graphic2D. You can retrieve Graphic2D from the BufferedImage to manipulate and draw on your image.
Basically, you should create a 2nd image with greater dimension and draw the first one in it at the right position to leave white space in the 1st one.