Browse Source

add TiffInkSet property

pull/2363/head
Ildar Khayrutdinov 3 years ago
parent
commit
681c921b0b
  1. 26
      src/ImageSharp/Formats/Tiff/Constants/TiffInkSet.cs
  2. 10
      src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs

26
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;
/// <summary>
/// Enumeration representing the set of inks used in a separated (<see cref="TiffPhotometricInterpretation.Separated"/>) image.
/// </summary>
public enum TiffInkSet : ushort
{
/// <summary>
/// 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 <see cref="ExifTagValue.InkNames"/> field should not exist when InkSet=1.
/// </summary>
Cmyk = 1,
/// <summary>
/// Not CMYK.
/// See the <see cref="ExifTagValue.InkNames"/> field for a description of the inks to be used.
/// </summary>
NotCmyk = 2
}

10
src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs

@ -55,6 +55,11 @@ public class TiffFrameMetadata : IDeepCloneable
/// </summary>
public TiffPredictor? Predictor { get; set; }
/// <summary>
/// Gets or sets the set of inks used in a separated (<see cref="TiffPhotometricInterpretation.Separated"/>) image.
/// </summary>
public TiffInkSet? InkSet { get; set; }
/// <summary>
/// Returns a new <see cref="TiffFrameMetadata"/> instance parsed from the given Exif profile.
/// </summary>
@ -102,6 +107,11 @@ public class TiffFrameMetadata : IDeepCloneable
meta.Predictor = (TiffPredictor)predictorValue.Value;
}
if (profile.TryGetValue(ExifTag.InkSet, out IExifValue<ushort>? inkSetValue))
{
meta.InkSet = (TiffInkSet)inkSetValue.Value;
}
profile.RemoveValue(ExifTag.BitsPerSample);
profile.RemoveValue(ExifTag.Compression);
profile.RemoveValue(ExifTag.PhotometricInterpretation);

Loading…
Cancel
Save