【发布时间】:2011-10-25 02:53:06
【问题描述】:
我有一个大小为w by h 的图像。在Java中,我需要创建一个大小为w by h+20 的图像,其中顶部w by 20 pixels 是白色的,图像的其余部分与原始图像相同。
基本上我想知道如何在现有缓冲图像的顶部添加 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...
}
【问题讨论】:
-
@Amir,“基本上我想知道如何在现有缓冲图像的顶部添加 20 像素的白色。”
标签: java swing bufferedimage