Read Clipping Path Flatness
Read a TIFF image that contains an Adobe resource block for clipping paths, retrieve and display the clipping path name and flatness.
Сode Snippet
using (var reader = new TiffReader("TIFFWithClippingPath.tif"))
{
const int clippingPathKey = 0x0bb7;
if (reader.AdobeResources.Contains(clippingPathKey))
{
var arb = (AdobeResourceBlock)reader.AdobeResources[clippingPathKey];
byte nameSize = arb.Data[0];
Console.WriteLine($"Clipping path name: {System.Text.Encoding.UTF8.GetString(arb.Data.Skip(1).Take(nameSize).ToArray())}");
// Flatness is a fixed point value in format 8p16: one byte for integer and 2 bytes for fractional.
float flatness = (float)arb.Data[nameSize + 2] + ((float)(arb.Data[nameSize + 3] << 8 | arb.Data[nameSize + 4]) / ushort.MaxValue);
Console.WriteLine($"Flatness: {flatness}");
}
}
Input
TIFFWithClippingPath.tif
DownloadOutput
ReadClippingPathFlatness.txt
Clipping path name: DarkerArea
Flatness: 4
For AI-assisted development: Download Graphics Mill Code Samples XML Catalog