Tag: libtiff

将自定义标记添加到TIFF文件

我对libtiff很新,但我已经成功地保存并打开了tiff文件而没有太多麻烦。 现在,我雄心勃勃,并试图在我的文件中添加自定义标签。 我已经阅读了文档( 参见此处 )并编写了一些无错误编译的测试代码,但在第一次调用具有自定义字段的TIFFSetField时,在运行时失败时出现访问冲突(使用标准字段调用TIFFSetField很好)。 我的测试代码如下:不到100行,唯一的外部依赖(除了libtiff)是我从.pgm文件打开测试图像的代码。 谁能指出我做错了什么? 顺便说一下,我正在使用libtiff 4.0.3。 #include “stdafx.h” #include “PGM.h” // Just for reading in the test image #include “tiffio.h” // There are a number of TIFF-related definitions we need to make in order to support the custom tags // that we want to include in our files. The form of these […]

TIFF图像:16bits-RGBA图像像素是如何隔行扫描的?

我试图通过C语言处理每通道16位RGBA TIFF图像,我在规范中找不到关于16位图像的大量信息。 在每通道8位RGBA图像的情况下,我理解像素存储为uint32,并且可以通过将32位分组为8位的4组(R,G,B,A)来进行去交错。 然后,为了处理每通道8位RGBA图像,我正在做以下(请参阅此处附带的源代码): 我将图像数据存储为uint32选项卡(使用TIFFReadRGBAImageOriented),我称之为data_tiff 我使用以下命令对像素进行去隔行扫描: (uint8) TIFFGetR(*data_tiff) , (uint8) TIFFGetG(*data_tiff) , (uint8) TIFFGetB(*data_tiff) & (uint8) TIFFGetA(*data_tiff) 如果每通道RGBA图像为16位,您能告诉我如何对像素进行去隔行扫描? 如果我可以将图像数据作为uint64选项卡进行检索,那么我可以执行以下操作: #define TIFF16GetR(abgr) ((abgr) & 0xffff) #define TIFF16GetG(abgr) (((abgr) >> 16) & 0xffff) #define TIFF16GetB(abgr) (((abgr) >> 32) & 0xffff) #define TIFF16GetA(abgr) (((abgr) >> 48) & 0xffff)` 我将图像数据作为uint64选项卡读取 我使用(uint16) TIFF16GetR(*data_tiff) , (uint16) TIFF16GetG(*data_tiff) , (uint16) TIFF16GetB(*data_tiff) & […]