【发布时间】:2013-01-17 11:31:31
【问题描述】:
我在 java 中有一个程序,其中在源缓冲图像中读取 tif 文件,然后将此缓冲图像复制为目标缓冲图像。 当我将这个缓冲图像写入磁盘时,图像会丢失其坐标信息。 怎样做才能不丢失坐标信息?
我的代码是:
/* Check if imageType if tif */
if (imageType.equalsIgnoreCase(TIFF)) {
bufferedImageType = BufferedImage.TYPE_INT_RGB;
}
BufferedImage destination = new BufferedImage(source.getWidth(), source.getHeight(),
bufferedImageType);
/* Loop to cover all pixels */
for (int width = 0; width < source.getWidth(); width++) {
/* Loop to cover all lines */
for (int height = 0; height < source.getHeight(); height++) {
destination.setRGB(width, height, source.getRGB(width, height));
}
}
file = new File(TEMP_DIR + TEMP_FILE_NAME + "tif");
ImageIO.write(destination, "tif", file);
【问题讨论】:
-
“坐标信息” DYM 拍摄照片的地点/日期?
标签: java image-processing bufferedimage javax.imageio