0

Im using NetVips to create png composites out of b-w separations. Pseudo code looks like this:

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);

This creates the png according separations and iccprofile. Everything is perfect

But if I just provide a K separation

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);

I run into VipsException: unable to call icc_import icc_import: no input profile

Can somebody advice how to create the png with icc-profile and one K separation?

I have limited knowhow about image processing. NetVips provides a hugh amount of possibilities. To improve my knowhow: Can somebody provide some recommendations for links or books?

Thanks Vik

Vik
  • 333
  • 5
  • 14

1 Answers1

0

Found the correct solution:

Fill all not used color separation with empty images.

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

Then the cmyk composite is created. Important is the order in sources: First is C, last is K

Vik
  • 333
  • 5
  • 14