0

我使用 NetVips 从 bw 分色中创建 png 合成。伪代码如下所示:

List<NetVips.Image> sources = new List<NetVips.Image>()
sources.Add(NetVips.Image.Pngload(cFilePath, access: NetVips.Enums.Access.Sequential);
sources.Add(NetVips.Image.Pngload(mFilePath, access: NetVips.Enums.Access.Sequential);
sources.Add(NetVips.Image.Pngload(yFilePath, access: NetVips.Enums.Access.Sequential);
sources.Add(NetVips.Image.Pngload(kFilePath, access: NetVips.Enums.Access.Sequential);

destination = sources.First()
sources.Remove(destination);

destination.Bandjoin(sources.ToArray());
destination = destination.Copy(bands: sources.Count, format: "uchar", interpretation: "cmyk").Cache(-1);
destination = destination.IccImport(intent: renderIntent, inputProfile: iccprofile);
destination.Pngsave(destinationPath);

这将根据分色和 iccprofile 创建 png。一切都很完美

但如果我只提供一个 K 分离

List<NetVips.Image> sources = new List<NetVips.Image>()
sources.Add(NetVips.Image.Pngload(kFilePath, access: NetVips.Enums.Access.Sequential);

destination = sources.First()
sources.Remove(destination);

destination.Bandjoin(sources.ToArray());
destination = destination.Copy(bands: sources.Count, format: "uchar", interpretation: "cmyk").Cache(-1);
destination = destination.IccImport(intent: renderIntent, inputProfile: iccprofile);
destination.Pngsave(destinationPath);

我遇到 VipsException:无法调用 icc_import icc_import:没有输入配置文件

有人可以建议如何使用 icc-profile 和一个 K 分隔创建 png 吗?

我对图像处理的了解有限。NetVips 提供了大量的可能性。为了提高我的专业知识:有人可以为链接或书籍提供一些建议吗?

谢谢维克

4

1 回答 1

0

找到了正确的解决方案:

用空图像填充所有未使用的分色。

double[,] emptyArray = new double[usedImage.Width, usedImage.Height];
NetVips.Image emptyImage = NetVips.Image.NewFromMemory(emptyArray, usedImage.Width, usedImage.Height, 1, "uchar");
sources.Add(emptyImage);

然后创建 cmyk 复合材料。重要的是源中的顺序:首先是 C,最后是 K

于 2020-05-11T14:54:29.813 回答