From 681c921b0bf3da865788fdceea9198ec0d73cdc8 Mon Sep 17 00:00:00 2001 From: Ildar Khayrutdinov Date: Mon, 20 Feb 2023 11:19:59 +0300 Subject: [PATCH] add TiffInkSet property --- .../Formats/Tiff/Constants/TiffInkSet.cs | 26 +++++++++++++++++++ .../Formats/Tiff/TiffFrameMetadata.cs | 10 +++++++ 2 files changed, 36 insertions(+) create mode 100644 src/ImageSharp/Formats/Tiff/Constants/TiffInkSet.cs diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffInkSet.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffInkSet.cs new file mode 100644 index 000000000..abdaca890 --- /dev/null +++ b/src/ImageSharp/Formats/Tiff/Constants/TiffInkSet.cs @@ -0,0 +1,26 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using SixLabors.ImageSharp.Metadata.Profiles.Exif; + +namespace SixLabors.ImageSharp.Formats.Tiff.Constants; + +/// +/// Enumeration representing the set of inks used in a separated () image. +/// +public enum TiffInkSet : ushort +{ + /// + /// CMYK. + /// The order of the components is cyan, magenta, yellow, black. + /// Usually, a value of 0 represents 0% ink coverage and a value of 255 represents 100% ink coverage for that component, but see DotRange. + /// The field should not exist when InkSet=1. + /// + Cmyk = 1, + + /// + /// Not CMYK. + /// See the field for a description of the inks to be used. + /// + NotCmyk = 2 +} diff --git a/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs b/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs index 5d0b85bf2..c0cbd7e87 100644 --- a/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs +++ b/src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs @@ -55,6 +55,11 @@ public class TiffFrameMetadata : IDeepCloneable /// public TiffPredictor? Predictor { get; set; } + /// + /// Gets or sets the set of inks used in a separated () image. + /// + public TiffInkSet? InkSet { get; set; } + /// /// Returns a new instance parsed from the given Exif profile. /// @@ -102,6 +107,11 @@ public class TiffFrameMetadata : IDeepCloneable meta.Predictor = (TiffPredictor)predictorValue.Value; } + if (profile.TryGetValue(ExifTag.InkSet, out IExifValue? inkSetValue)) + { + meta.InkSet = (TiffInkSet)inkSetValue.Value; + } + profile.RemoveValue(ExifTag.BitsPerSample); profile.RemoveValue(ExifTag.Compression); profile.RemoveValue(ExifTag.PhotometricInterpretation);