我有一张尺寸为
基本上,我想知道如何在现有缓冲图像的顶部添加20个像素的白色。
代码应该是这样的:
w
x h
的图片。在Java中,我需要创建一张大小为w
x h+20
的图片,其中顶部w
x 20像素
是白色的,其余部分与原始图片相同。基本上,我想知道如何在现有缓冲图像的顶部添加20个像素的白色。
代码应该是这样的:
public static void main (String[] args) {
BufferedImage originalImage = [the original image with a specific file path];
...code to create a new image 20 pixels higher...
...code to paint originalImage 20 pixels down on the new image
...code to save the new image...
}