Read/Write 使用 Go 和 OpenCV 的图像中的 ICC 配置文件
Read/Write ICC Profile In Images with Go and OpenCV
我正在编写代码以使用 Go 和 go-opencv package 调整图像大小。调整大小后,我写出的图像缺少原始图像中的 ICC 配置文件。
有没有可以 read/write ICC 配置文件的 Go 或 C 库?目标是不使用命令行工具,而是使用 Go/C 库,这样我就可以在流程中完成所有这些工作。我知道 exiftool 存在并且可以为我做这件事,但我不想 shell 使用 perl 脚本。
我只知道go-iccjpeg:
A small utility package to extract International Color Consortium (ICC) profiles from JPEG buffers.
import "github.com/vimeo/go-iccjpeg/iccjpeg"
iccjpeg.GetICCBuf(input io.Reader) ([]byte, error)
It takes an io.Reader
with a JPEG, and returns a buffer with the embedded ICC profile from that JPEG, if there is one.
If there is not one, it returns an empty buffer.
经过更多研究,我发现 libvips and the go bindings。
libvips 不会删除任何嵌入的配置文件。这个blog post提到这个:
The file load/save operations (like tiffload, jpegsave etc.) don't do anything with colour. On load they attach any ICC profiles they see to the vips image as metadata and on save they write any attached profile to the file. They aim to give you something very close to what's actually stored in the file and leave colour processing for you to arrange.
我正在编写代码以使用 Go 和 go-opencv package 调整图像大小。调整大小后,我写出的图像缺少原始图像中的 ICC 配置文件。
有没有可以 read/write ICC 配置文件的 Go 或 C 库?目标是不使用命令行工具,而是使用 Go/C 库,这样我就可以在流程中完成所有这些工作。我知道 exiftool 存在并且可以为我做这件事,但我不想 shell 使用 perl 脚本。
我只知道go-iccjpeg:
A small utility package to extract International Color Consortium (ICC) profiles from JPEG buffers.
import "github.com/vimeo/go-iccjpeg/iccjpeg"
iccjpeg.GetICCBuf(input io.Reader) ([]byte, error)
It takes an
io.Reader
with a JPEG, and returns a buffer with the embedded ICC profile from that JPEG, if there is one.
If there is not one, it returns an empty buffer.
经过更多研究,我发现 libvips and the go bindings。
libvips 不会删除任何嵌入的配置文件。这个blog post提到这个:
The file load/save operations (like tiffload, jpegsave etc.) don't do anything with colour. On load they attach any ICC profiles they see to the vips image as metadata and on save they write any attached profile to the file. They aim to give you something very close to what's actually stored in the file and leave colour processing for you to arrange.