How to add 20 pixels of white at the top of an existing image file?

后端 未结 3 1262
栀梦
栀梦 2020-12-20 20:56

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

3条回答
  •  悲哀的现实
    2020-12-20 21:30

    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.

提交回复
热议问题