diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffCompression.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffCompression.cs
index 4caa7887db..7880f683e3 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffCompression.cs
@@ -10,28 +10,64 @@ namespace ImageSharp.Formats
///
internal enum TiffCompression
{
- // TIFF baseline compression types
-
+ ///
+ /// No compression.
+ ///
None = 1,
+
+ ///
+ /// CCITT Group 3 1-Dimensional Modified Huffman run-length encoding.
+ ///
Ccitt1D = 2,
- PackBits = 32773,
- // TIFF Extension compression types
+ ///
+ /// PackBits compression
+ ///
+ PackBits = 32773,
+ ///
+ /// T4-encoding: CCITT T.4 bi-level encoding (see Section 11 of the TIFF 6.0 specification).
+ ///
CcittGroup3Fax = 3,
+
+ ///
+ /// T6-encoding: CCITT T.6 bi-level encoding (see Section 11 of the TIFF 6.0 specification).
+ ///
CcittGroup4Fax = 4,
+
+ ///
+ /// LZW compression (see Section 13 of the TIFF 6.0 specification).
+ ///
Lzw = 5,
- OldJpeg = 6,
- // Technote 2
+ ///
+ /// JPEG compression - obsolete (see Section 22 of the TIFF 6.0 specification).
+ ///
+ OldJpeg = 6,
+ ///
+ /// JPEG compression (see TIFF Specification, supplement 2).
+ ///
Jpeg = 7,
+
+ ///
+ /// Deflate compression, using zlib data format (see TIFF Specification, supplement 2).
+ ///
Deflate = 8,
- OldDeflate = 32946,
- // TIFF-F/FX Extension
+ ///
+ /// Deflate compression - old.
+ ///
+ OldDeflate = 32946,
+ ///
+ /// ITU-T Rec. T.82 coding, applying ITU-T Rec. T.85 (JBIG) (see RFC2301).
+ ///
ItuTRecT82 = 9,
+
+ ///
+ /// ITU-T Rec. T.43 representation, using ITU-T Rec. T.82 (JBIG) (see RFC2301).
+ ///
ItuTRecT43 = 10
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffConstants.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffConstants.cs
index f6242aa43f..77cf5e0bdb 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffConstants.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffConstants.cs
@@ -39,7 +39,7 @@ namespace ImageSharp.Formats
/// Size (in bytes) of the Short and SShort data types
///
public const int SizeOfShort = 2;
-
+
///
/// Size (in bytes) of the Long and SLong data types
///
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffExtraSamples.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffExtraSamples.cs
index 4fa153fc54..d15d312f14 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffExtraSamples.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffExtraSamples.cs
@@ -6,14 +6,23 @@
namespace ImageSharp.Formats
{
///
- /// Enumeration representing the possible uses of extra-samples in TIFF format files.
+ /// Enumeration representing the possible uses of extra components in TIFF format files.
///
internal enum TiffExtraSamples
{
- // TIFF baseline ExtraSample values
-
+ ///
+ /// Unspecified data.
+ ///
Unspecified = 0,
+
+ ///
+ /// Associated alpha data (with pre-multiplied color).
+ ///
AssociatedAlpha = 1,
+
+ ///
+ /// Unassociated alpha data.
+ ///
UnassociatedAlpha = 2
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffFillOrder.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffFillOrder.cs
index e520599b43..99d88e90e9 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffFillOrder.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffFillOrder.cs
@@ -10,9 +10,14 @@ namespace ImageSharp.Formats
///
internal enum TiffFillOrder
{
- // TIFF baseline FillOrder values
-
+ ///
+ /// Pixels with lower column values are stored in the higher-order bits of the byte.
+ ///
MostSignificantBitFirst = 1,
+
+ ///
+ /// Pixels with lower column values are stored in the lower-order bits of the byte.
+ ///
LeastSignificantBitFirst = 2
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffNewSubfileType.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffNewSubfileType.cs
index 9a6fa497e5..3d1885377c 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffNewSubfileType.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffNewSubfileType.cs
@@ -13,19 +13,34 @@ namespace ImageSharp.Formats
[Flags]
internal enum TiffNewSubfileType
{
- // TIFF baseline subfile types
-
+ ///
+ /// A full-resolution image.
+ ///
FullImage = 0x0000,
+
+ ///
+ /// Reduced-resolution version of another image in this TIFF file.
+ ///
Preview = 0x0001,
+
+ ///
+ /// A single page of a multi-page image.
+ ///
SinglePage = 0x0002,
- TransparencyMask = 0x0004,
- // DNG Specification subfile types
+ ///
+ /// A transparency mask for another image in this TIFF file.
+ ///
+ TransparencyMask = 0x0004,
+ ///
+ /// Alternative reduced-resolution version of another image in this TIFF file (see DNG specification).
+ ///
AlternativePreview = 0x10000,
- // TIFF-F/FX Specification subfile types
-
+ ///
+ /// Mixed raster content (see RFC2301).
+ ///
MixedRasterContent = 0x0008
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffOrientation.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffOrientation.cs
index 6dbdec4842..8f14693543 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffOrientation.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffOrientation.cs
@@ -10,15 +10,44 @@ namespace ImageSharp.Formats
///
internal enum TiffOrientation
{
- // TIFF baseline Orientation values
-
+ ///
+ /// The 0th row and 0th column represent the visual top and left-hand side of the image respectively.
+ ///
TopLeft = 1,
+
+ ///
+ /// The 0th row and 0th column represent the visual top and right-hand side of the image respectively.
+ ///
TopRight = 2,
+
+ ///
+ /// The 0th row and 0th column represent the visual bottom and right-hand side of the image respectively.
+ ///
BottomRight = 3,
+
+ ///
+ /// The 0th row and 0th column represent the visual bottom and left-hand side of the image respectively.
+ ///
BottomLeft = 4,
+
+ ///
+ /// The 0th row and 0th column represent the visual left-hand side and top of the image respectively.
+ ///
LeftTop = 5,
+
+ ///
+ /// The 0th row and 0th column represent the visual right-hand side and top of the image respectively.
+ ///
RightTop = 6,
+
+ ///
+ /// The 0th row and 0th column represent the visual right-hand side and bottom of the image respectively.
+ ///
RightBottom = 7,
+
+ ///
+ /// The 0th row and 0th column represent the visual left-hand side and bottom of the image respectively.
+ ///
LeftBottom = 8
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffPhotometricInterpretation.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffPhotometricInterpretation.cs
index 0894c2dad1..21f1b56e88 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffPhotometricInterpretation.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffPhotometricInterpretation.cs
@@ -10,31 +10,64 @@ namespace ImageSharp.Formats
///
internal enum TiffPhotometricInterpretation
{
- // TIFF baseline color spaces
-
+ ///
+ /// Bilevel and grayscale: 0 is imaged as white. The maximum value is imaged as black.
+ ///
WhiteIsZero = 0,
+
+ ///
+ /// Bilevel and grayscale: 0 is imaged as black. The maximum value is imaged as white.
+ ///
BlackIsZero = 1,
+
+ ///
+ /// RGB
+ ///
Rgb = 2,
+
+ ///
+ /// Palette Color
+ ///
PaletteColor = 3,
- TransparencyMask = 4,
- // TIFF Extension color spaces
+ ///
+ /// A transparency mask
+ ///
+ TransparencyMask = 4,
+ ///
+ /// Separated: usually CMYK (see Section 16 of the TIFF 6.0 specification).
+ ///
Separated = 5,
+
+ ///
+ /// YCbCr (see Section 21 of the TIFF 6.0 specification).
+ ///
YCbCr = 6,
- CieLab = 8,
- // TIFF TechNote 1
+ ///
+ /// 1976 CIE L*a*b* (see Section 23 of the TIFF 6.0 specification).
+ ///
+ CieLab = 8,
+ ///
+ /// ICC L*a*b* (see TIFF Specification, supplement 1).
+ ///
IccLab = 9,
- // TIFF-F/FX Specification
-
+ ///
+ /// ITU L*a*b* (see RFC2301).
+ ///
ItuLab = 10,
- // DNG Specification
-
+ ///
+ /// Color Filter Array (see the DNG specification).
+ ///
ColorFilterArray = 32803,
+
+ ///
+ /// Linear Raw (see the DNG specification).
+ ///
LinearRaw = 34892
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffPlanarConfiguration.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffPlanarConfiguration.cs
index 0c9e08302a..e3c40adfd5 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffPlanarConfiguration.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffPlanarConfiguration.cs
@@ -6,13 +6,18 @@
namespace ImageSharp.Formats
{
///
- /// Enumeration representing the planar configuration types defined by the Tiff file-format.
+ /// Enumeration representing how the components of each pixel are stored the Tiff file-format.
///
internal enum TiffPlanarConfiguration
{
- // TIFF baseline PlanarConfiguration values
-
+ ///
+ /// Chunky format.
+ ///
Chunky = 1,
+
+ ///
+ /// Planar format.
+ ///
Planar = 2
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffResolutionUnit.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffResolutionUnit.cs
index 9275a79fb2..582c476443 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffResolutionUnit.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffResolutionUnit.cs
@@ -10,10 +10,19 @@ namespace ImageSharp.Formats
///
internal enum TiffResolutionUnit
{
- // TIFF baseline ResolutionUnit values
-
+ ///
+ /// No absolute unit of measurement.
+ ///
None = 1,
+
+ ///
+ /// Inch.
+ ///
Inch = 2,
+
+ ///
+ /// Centimeter.
+ ///
Centimeter = 2
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffSubfileType.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffSubfileType.cs
index 0b256f0317..6a86f3b30d 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffSubfileType.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffSubfileType.cs
@@ -10,10 +10,19 @@ namespace ImageSharp.Formats
///
internal enum TiffSubfileType
{
- // TIFF baseline subfile types
-
+ ///
+ /// Full-resolution image data.
+ ///
FullImage = 1,
+
+ ///
+ /// Reduced-resolution image data.
+ ///
Preview = 2,
+
+ ///
+ /// A single page of a multi-page image.
+ ///
SinglePage = 3
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffTags.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffTags.cs
index 41721fb1d9..56fc71461f 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffTags.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffTags.cs
@@ -10,196 +10,709 @@ namespace ImageSharp.Formats
///
internal class TiffTags
{
- // Section 8: Baseline Fields
-
+ ///
+ /// Artist (see Section 8: Baseline Fields).
+ ///
public const int Artist = 315;
+
+ ///
+ /// BitsPerSample (see Section 8: Baseline Fields).
+ ///
public const int BitsPerSample = 258;
+
+ ///
+ /// CellLength (see Section 8: Baseline Fields).
+ ///
public const int CellLength = 265;
+
+ ///
+ /// CellWidth (see Section 8: Baseline Fields).
+ ///
public const int CellWidth = 264;
+
+ ///
+ /// ColorMap (see Section 8: Baseline Fields).
+ ///
public const int ColorMap = 320;
+
+ ///
+ /// Compression (see Section 8: Baseline Fields).
+ ///
public const int Compression = 259;
+
+ ///
+ /// Copyright (see Section 8: Baseline Fields).
+ ///
public const int Copyright = 33432;
+
+ ///
+ /// DateTime (see Section 8: Baseline Fields).
+ ///
public const int DateTime = 306;
+
+ ///
+ /// ExtraSamples (see Section 8: Baseline Fields).
+ ///
public const int ExtraSamples = 338;
+
+ ///
+ /// FillOrder (see Section 8: Baseline Fields).
+ ///
public const int FillOrder = 266;
+
+ ///
+ /// FreeByteCounts (see Section 8: Baseline Fields).
+ ///
public const int FreeByteCounts = 289;
+
+ ///
+ /// FreeOffsets (see Section 8: Baseline Fields).
+ ///
public const int FreeOffsets = 288;
+
+ ///
+ /// GrayResponseCurve (see Section 8: Baseline Fields).
+ ///
public const int GrayResponseCurve = 291;
+
+ ///
+ /// GrayResponseUnit (see Section 8: Baseline Fields).
+ ///
public const int GrayResponseUnit = 290;
+
+ ///
+ /// HostComputer (see Section 8: Baseline Fields).
+ ///
public const int HostComputer = 316;
+
+ ///
+ /// ImageDescription (see Section 8: Baseline Fields).
+ ///
public const int ImageDescription = 270;
+
+ ///
+ /// ImageLength (see Section 8: Baseline Fields).
+ ///
public const int ImageLength = 257;
+
+ ///
+ /// ImageWidth (see Section 8: Baseline Fields).
+ ///
public const int ImageWidth = 256;
+
+ ///
+ /// Make (see Section 8: Baseline Fields).
+ ///
public const int Make = 271;
+
+ ///
+ /// MaxSampleValue (see Section 8: Baseline Fields).
+ ///
public const int MaxSampleValue = 281;
+
+ ///
+ /// MinSampleValue (see Section 8: Baseline Fields).
+ ///
public const int MinSampleValue = 280;
+
+ ///
+ /// Model (see Section 8: Baseline Fields).
+ ///
public const int Model = 272;
+
+ ///
+ /// NewSubfileType (see Section 8: Baseline Fields).
+ ///
public const int NewSubfileType = 254;
+
+ ///
+ /// Orientation (see Section 8: Baseline Fields).
+ ///
public const int Orientation = 274;
+
+ ///
+ /// PhotometricInterpretation (see Section 8: Baseline Fields).
+ ///
public const int PhotometricInterpretation = 262;
+
+ ///
+ /// PlanarConfiguration (see Section 8: Baseline Fields).
+ ///
public const int PlanarConfiguration = 284;
+
+ ///
+ /// ResolutionUnit (see Section 8: Baseline Fields).
+ ///
public const int ResolutionUnit = 296;
+
+ ///
+ /// RowsPerStrip (see Section 8: Baseline Fields).
+ ///
public const int RowsPerStrip = 278;
+
+ ///
+ /// SamplesPerPixel (see Section 8: Baseline Fields).
+ ///
public const int SamplesPerPixel = 277;
+
+ ///
+ /// Software (see Section 8: Baseline Fields).
+ ///
public const int Software = 305;
+
+ ///
+ /// StripByteCounts (see Section 8: Baseline Fields).
+ ///
public const int StripByteCounts = 279;
+
+ ///
+ /// StripOffsets (see Section 8: Baseline Fields).
+ ///
public const int StripOffsets = 273;
+
+ ///
+ /// SubfileType (see Section 8: Baseline Fields).
+ ///
public const int SubfileType = 255;
+
+ ///
+ /// Threshholding (see Section 8: Baseline Fields).
+ ///
public const int Threshholding = 263;
+
+ ///
+ /// XResolution (see Section 8: Baseline Fields).
+ ///
public const int XResolution = 282;
- public const int YResolution = 283;
- // Section 11: CCITT Bilevel Encodings
+ ///
+ /// YResolution (see Section 8: Baseline Fields).
+ ///
+ public const int YResolution = 283;
+ ///
+ /// T4Options (see Section 11: CCITT Bilevel Encodings).
+ ///
public const int T4Options = 292;
- public const int T6Options = 293;
- // Section 12: Document Storage and Retrieval
+ ///
+ /// T6Options (see Section 11: CCITT Bilevel Encodings).
+ ///
+ public const int T6Options = 293;
+ ///
+ /// DocumentName (see Section 12: Document Storage and Retrieval).
+ ///
public const int DocumentName = 269;
+
+ ///
+ /// PageName (see Section 12: Document Storage and Retrieval).
+ ///
public const int PageName = 285;
+
+ ///
+ /// PageNumber (see Section 12: Document Storage and Retrieval).
+ ///
public const int PageNumber = 297;
+
+ ///
+ /// XPosition (see Section 12: Document Storage and Retrieval).
+ ///
public const int XPosition = 286;
- public const int YPosition = 287;
- // Section 14: Differencing Predictor
+ ///
+ /// YPosition (see Section 12: Document Storage and Retrieval).
+ ///
+ public const int YPosition = 287;
+ ///
+ /// Predictor (see Section 14: Differencing Predictor).
+ ///
public const int Predictor = 317;
- // Section 15: Tiled Images
-
+ ///
+ /// TileWidth (see Section 15: Tiled Images).
+ ///
public const int TileWidth = 322;
+
+ ///
+ /// TileLength (see Section 15: Tiled Images).
+ ///
public const int TileLength = 323;
+
+ ///
+ /// TileOffsets (see Section 15: Tiled Images).
+ ///
public const int TileOffsets = 324;
- public const int TileByteCounts = 325;
- // Section 16: CMYK Images
+ ///
+ /// TileByteCounts (see Section 15: Tiled Images).
+ ///
+ public const int TileByteCounts = 325;
+ ///
+ /// InkSet (see Section 16: CMYK Images).
+ ///
public const int InkSet = 332;
+
+ ///
+ /// NumberOfInks (see Section 16: CMYK Images).
+ ///
public const int NumberOfInks = 334;
+
+ ///
+ /// InkNames (see Section 16: CMYK Images).
+ ///
public const int InkNames = 333;
+
+ ///
+ /// DotRange (see Section 16: CMYK Images).
+ ///
public const int DotRange = 336;
- public const int TargetPrinter = 337;
- // Section 17: Halftone Hints
+ ///
+ /// TargetPrinter (see Section 16: CMYK Images).
+ ///
+ public const int TargetPrinter = 337;
+ ///
+ /// HalftoneHints (see Section 17: Halftone Hints).
+ ///
public const int HalftoneHints = 321;
- // Section 19: Data Sample Format
-
+ ///
+ /// SampleFormat (see Section 19: Data Sample Format).
+ ///
public const int SampleFormat = 339;
+
+ ///
+ /// SMinSampleValue (see Section 19: Data Sample Format).
+ ///
public const int SMinSampleValue = 340;
- public const int SMaxSampleValue = 341;
- // Section 20: RGB Image Colorimetry
+ ///
+ /// SMaxSampleValue (see Section 19: Data Sample Format).
+ ///
+ public const int SMaxSampleValue = 341;
+ ///
+ /// WhitePoint (see Section 20: RGB Image Colorimetry).
+ ///
public const int WhitePoint = 318;
+
+ ///
+ /// PrimaryChromaticities (see Section 20: RGB Image Colorimetry).
+ ///
public const int PrimaryChromaticities = 319;
+
+ ///
+ /// TransferFunction (see Section 20: RGB Image Colorimetry).
+ ///
public const int TransferFunction = 301;
+
+ ///
+ /// TransferRange (see Section 20: RGB Image Colorimetry).
+ ///
public const int TransferRange = 342;
- public const int ReferenceBlackWhite = 532;
- // Section 21: YCbCr Images
+ ///
+ /// ReferenceBlackWhite (see Section 20: RGB Image Colorimetry).
+ ///
+ public const int ReferenceBlackWhite = 532;
+ ///
+ /// YCbCrCoefficients (see Section 21: YCbCr Images).
+ ///
public const int YCbCrCoefficients = 529;
+
+ ///
+ /// YCbCrSubSampling (see Section 21: YCbCr Images).
+ ///
public const int YCbCrSubSampling = 530;
- public const int YCbCrPositioning = 531;
- // Section 22: JPEG Compression
+ ///
+ /// YCbCrPositioning (see Section 21: YCbCr Images).
+ ///
+ public const int YCbCrPositioning = 531;
+ ///
+ /// JpegProc (see Section 22: JPEG Compression).
+ ///
public const int JpegProc = 512;
+
+ ///
+ /// JpegInterchangeFormat (see Section 22: JPEG Compression).
+ ///
public const int JpegInterchangeFormat = 513;
+
+ ///
+ /// JpegInterchangeFormatLength (see Section 22: JPEG Compression).
+ ///
public const int JpegInterchangeFormatLength = 514;
+
+ ///
+ /// JpegRestartInterval (see Section 22: JPEG Compression).
+ ///
public const int JpegRestartInterval = 515;
+
+ ///
+ /// JpegLosslessPredictors (see Section 22: JPEG Compression).
+ ///
public const int JpegLosslessPredictors = 517;
+
+ ///
+ /// JpegPointTransforms (see Section 22: JPEG Compression).
+ ///
public const int JpegPointTransforms = 518;
+
+ ///
+ /// JpegQTables (see Section 22: JPEG Compression).
+ ///
public const int JpegQTables = 519;
+
+ ///
+ /// JpegDCTables (see Section 22: JPEG Compression).
+ ///
public const int JpegDCTables = 520;
- public const int JpegACTables = 521;
- // TIFF Supplement 1: Adobe Pagemaker 6.0
+ ///
+ /// JpegACTables (see Section 22: JPEG Compression).
+ ///
+ public const int JpegACTables = 521;
+ ///
+ /// SubIFDs (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
public const int SubIFDs = 330;
+
+ ///
+ /// ClipPath (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
public const int ClipPath = 343;
+
+ ///
+ /// XClipPathUnits (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
public const int XClipPathUnits = 344;
+
+ ///
+ /// YClipPathUnits (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
public const int YClipPathUnits = 345;
+
+ ///
+ /// Indexed (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
public const int Indexed = 346;
+
+ ///
+ /// ImageID (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
public const int ImageID = 32781;
- public const int OpiProxy = 351;
- // TIFF Supplement 2: Adobe Photoshop
+ ///
+ /// OpiProxy (see TIFF Supplement 1: Adobe Pagemaker 6.0).
+ ///
+ public const int OpiProxy = 351;
+ ///
+ /// ImageSourceData (see TIFF Supplement 2: Adobe Photoshop).
+ ///
public const int ImageSourceData = 37724;
- // TIFF/EP Specification: Additional Tags
-
+ ///
+ /// JPEGTables (see TIFF/EP Specification: Additional Tags).
+ ///
public const int JPEGTables = 0x015B;
+
+ ///
+ /// CFARepeatPatternDim (see TIFF/EP Specification: Additional Tags).
+ ///
public const int CFARepeatPatternDim = 0x828D;
+
+ ///
+ /// BatteryLevel (see TIFF/EP Specification: Additional Tags).
+ ///
public const int BatteryLevel = 0x828F;
+
+ ///
+ /// Interlace (see TIFF/EP Specification: Additional Tags).
+ ///
public const int Interlace = 0x8829;
+
+ ///
+ /// TimeZoneOffset (see TIFF/EP Specification: Additional Tags).
+ ///
public const int TimeZoneOffset = 0x882A;
+
+ ///
+ /// SelfTimerMode (see TIFF/EP Specification: Additional Tags).
+ ///
public const int SelfTimerMode = 0x882B;
+
+ ///
+ /// Noise (see TIFF/EP Specification: Additional Tags).
+ ///
public const int Noise = 0x920D;
+
+ ///
+ /// ImageNumber (see TIFF/EP Specification: Additional Tags).
+ ///
public const int ImageNumber = 0x9211;
+
+ ///
+ /// SecurityClassification (see TIFF/EP Specification: Additional Tags).
+ ///
public const int SecurityClassification = 0x9212;
+
+ ///
+ /// ImageHistory (see TIFF/EP Specification: Additional Tags).
+ ///
public const int ImageHistory = 0x9213;
- public const int TiffEPStandardID = 0x9216;
- // TIFF-F/FX Specification (http://www.ietf.org/rfc/rfc2301.txt)
+ ///
+ /// TiffEPStandardID (see TIFF/EP Specification: Additional Tags).
+ ///
+ public const int TiffEPStandardID = 0x9216;
+ ///
+ /// BadFaxLines (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int BadFaxLines = 326;
+
+ ///
+ /// CleanFaxData (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int CleanFaxData = 327;
+
+ ///
+ /// ConsecutiveBadFaxLines (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int ConsecutiveBadFaxLines = 328;
+
+ ///
+ /// GlobalParametersIFD (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int GlobalParametersIFD = 400;
+
+ ///
+ /// ProfileType (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int ProfileType = 401;
+
+ ///
+ /// FaxProfile (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int FaxProfile = 402;
+
+ ///
+ /// CodingMethod (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int CodingMethod = 403;
+
+ ///
+ /// VersionYear (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int VersionYear = 404;
+
+ ///
+ /// ModeNumber (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int ModeNumber = 405;
+
+ ///
+ /// Decode (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int Decode = 433;
+
+ ///
+ /// DefaultImageColor (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int DefaultImageColor = 434;
+
+ ///
+ /// StripRowCounts (see RFC2301: TIFF-F/FX Specification).
+ ///
public const int StripRowCounts = 559;
- public const int ImageLayer = 34732;
- // Embedded Metadata
+ ///
+ /// ImageLayer (see RFC2301: TIFF-F/FX Specification).
+ ///
+ public const int ImageLayer = 34732;
+ ///
+ /// Xmp (Embedded Metadata).
+ ///
public const int Xmp = 700;
+
+ ///
+ /// Iptc (Embedded Metadata).
+ ///
public const int Iptc = 33723;
+
+ ///
+ /// Photoshop (Embedded Metadata).
+ ///
public const int Photoshop = 34377;
+
+ ///
+ /// ExifIFD (Embedded Metadata).
+ ///
public const int ExifIFD = 34665;
+
+ ///
+ /// GpsIFD (Embedded Metadata).
+ ///
public const int GpsIFD = 34853;
- public const int InteroperabilityIFD = 40965;
- // Other Private TIFF tags (http://www.awaresystems.be/imaging/tiff/tifftags/private.html)
+ ///
+ /// InteroperabilityIFD (Embedded Metadata).
+ ///
+ public const int InteroperabilityIFD = 40965;
+ ///
+ /// WangAnnotation (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int WangAnnotation = 32932;
+
+ ///
+ /// MDFileTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDFileTag = 33445;
+
+ ///
+ /// MDScalePixel (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDScalePixel = 33446;
+
+ ///
+ /// MDColorTable (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDColorTable = 33447;
+
+ ///
+ /// MDLabName (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDLabName = 33448;
+
+ ///
+ /// MDSampleInfo (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDSampleInfo = 33449;
+
+ ///
+ /// MDPrepDate (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDPrepDate = 33450;
+
+ ///
+ /// MDPrepTime (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDPrepTime = 33451;
+
+ ///
+ /// MDFileUnits (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int MDFileUnits = 33452;
+
+ ///
+ /// ModelPixelScaleTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int ModelPixelScaleTag = 33550;
+
+ ///
+ /// IngrPacketDataTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int IngrPacketDataTag = 33918;
+
+ ///
+ /// IngrFlagRegisters (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int IngrFlagRegisters = 33919;
+
+ ///
+ /// IrasBTransformationMatrix (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int IrasBTransformationMatrix = 33920;
+
+ ///
+ /// ModelTiePointTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int ModelTiePointTag = 33922;
+
+ ///
+ /// ModelTransformationTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int ModelTransformationTag = 34264;
+
+ ///
+ /// IccProfile (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int IccProfile = 34675;
+
+ ///
+ /// GeoKeyDirectoryTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int GeoKeyDirectoryTag = 34735;
+
+ ///
+ /// GeoDoubleParamsTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int GeoDoubleParamsTag = 34736;
+
+ ///
+ /// GeoAsciiParamsTag (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int GeoAsciiParamsTag = 34737;
+
+ ///
+ /// HylaFAXFaxRecvParams (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int HylaFAXFaxRecvParams = 34908;
+
+ ///
+ /// HylaFAXFaxSubAddress (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int HylaFAXFaxSubAddress = 34909;
+
+ ///
+ /// HylaFAXFaxRecvTime (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int HylaFAXFaxRecvTime = 34910;
+
+ ///
+ /// GdalMetadata (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int GdalMetadata = 42112;
+
+ ///
+ /// GdalNodata (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int GdalNodata = 42113;
+
+ ///
+ /// OceScanjobDescription (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int OceScanjobDescription = 50215;
+
+ ///
+ /// OceApplicationSelector (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int OceApplicationSelector = 50216;
+
+ ///
+ /// OceIdentificationNumber (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int OceIdentificationNumber = 50217;
+
+ ///
+ /// OceImageLogicCharacteristics (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int OceImageLogicCharacteristics = 50218;
+
+ ///
+ /// AliasLayerMetadata (Other Private TIFF tags : see http://www.awaresystems.be/imaging/tiff/tifftags/private.html).
+ ///
public const int AliasLayerMetadata = 50784;
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffThreshholding.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffThreshholding.cs
index 72efa92225..eff57cd906 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffThreshholding.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffThreshholding.cs
@@ -6,14 +6,23 @@
namespace ImageSharp.Formats
{
///
- /// Enumeration representing the threshholding types defined by the Tiff file-format.
+ /// Enumeration representing the threshholding applied to image data defined by the Tiff file-format.
///
internal enum TiffThreshholding
{
- // TIFF baseline Threshholding values
-
+ ///
+ /// No dithering or halftoning.
+ ///
None = 1,
+
+ ///
+ /// An ordered dither or halftone technique.
+ ///
Ordered = 2,
+
+ ///
+ /// A randomized process such as error diffusion.
+ ///
Random = 3
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/Constants/TiffType.cs b/src/ImageSharp/Formats/Tiff/Constants/TiffType.cs
index b98236c0f7..0b342d06a9 100644
--- a/src/ImageSharp/Formats/Tiff/Constants/TiffType.cs
+++ b/src/ImageSharp/Formats/Tiff/Constants/TiffType.cs
@@ -10,18 +10,69 @@ namespace ImageSharp.Formats
///
internal enum TiffType
{
+ ///
+ /// Unsigned 8-bit integer.
+ ///
Byte = 1,
+
+ ///
+ /// ASCII formatted text.
+ ///
Ascii = 2,
+
+ ///
+ /// Unsigned 16-bit integer.
+ ///
Short = 3,
+
+ ///
+ /// Unsigned 32-bit integer.
+ ///
Long = 4,
+
+ ///
+ /// Unsigned rational number.
+ ///
Rational = 5,
+
+ ///
+ /// Signed 8-bit integer.
+ ///
SByte = 6,
+
+ ///
+ /// Undefined data type.
+ ///
Undefined = 7,
+
+ ///
+ /// Signed 16-bit integer.
+ ///
SShort = 8,
+
+ ///
+ /// Signed 32-bit integer.
+ ///
SLong = 9,
+
+ ///
+ /// Signed rational number.
+ ///
SRational = 10,
+
+ ///
+ /// Single precision (4-byte) IEEE format.
+ ///
Float = 11,
+
+ ///
+ /// Double precision (8-byte) IEEE format.
+ ///
Double = 12,
+
+ ///
+ /// Reference to an IFD.
+ ///
Ifd = 13
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
index 8e0a42515b..e24a1aa39e 100644
--- a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
@@ -28,6 +28,12 @@ namespace ImageSharp.Formats
this.options = options ?? new DecoderOptions();
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The input stream.
+ /// A flag indicating if the file is encoded in little-endian or big-endian format.
+ /// The decoder options.
public TiffDecoderCore(Stream stream, bool isLittleEndian, IDecoderOptions options)
: this(options)
{
@@ -45,6 +51,13 @@ namespace ImageSharp.Formats
///
public bool IsLittleEndian { get; private set; }
+ ///
+ /// Calculates the size (in bytes) of the data contained within an IFD entry.
+ ///
+ /// The IFD entry to calculate the size for.
+ /// The size of the data (in bytes).
+ public static uint GetSizeOfData(TiffIfdEntry entry) => SizeOfDataType(entry.Type) * entry.Count;
+
///
/// Decodes the image from the specified and sets
/// the data to image.
@@ -69,6 +82,13 @@ namespace ImageSharp.Formats
{
}
+ ///
+ /// Reads the TIFF header from the input stream.
+ ///
+ /// The byte offset to the first IFD in the file.
+ ///
+ /// Thrown if the TIFF file header is invalid.
+ ///
public uint ReadHeader()
{
byte[] headerBytes = new byte[TiffConstants.SizeOfTiffHeader];
@@ -97,6 +117,11 @@ namespace ImageSharp.Formats
return firstIfdOffset;
}
+ ///
+ /// Reads a from the input stream.
+ ///
+ /// The byte offset within the file to find the IFD.
+ /// A containing the retrieved data.
public TiffIfd ReadIfd(uint offset)
{
this.InputStream.Seek(offset, SeekOrigin.Begin);
@@ -125,24 +150,11 @@ namespace ImageSharp.Formats
return new TiffIfd(entries, nextIfdOffset);
}
- private void ReadBytes(byte[] buffer, int count)
- {
- int offset = 0;
-
- while (count > 0)
- {
- int bytesRead = this.InputStream.Read(buffer, offset, count);
-
- if (bytesRead == 0)
- {
- break;
- }
-
- offset += bytesRead;
- count -= bytesRead;
- }
- }
-
+ ///
+ /// Reads the data from a as an array of bytes.
+ ///
+ /// The to read.
+ /// The data.
public byte[] ReadBytes(ref TiffIfdEntry entry)
{
uint byteLength = GetSizeOfData(entry);
@@ -160,6 +172,15 @@ namespace ImageSharp.Formats
return entry.Value;
}
+ ///
+ /// Reads the data from a as an unsigned integer value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a , or if
+ /// there is an array of items.
+ ///
public uint ReadUnsignedInteger(ref TiffIfdEntry entry)
{
if (entry.Count != 1)
@@ -180,6 +201,15 @@ namespace ImageSharp.Formats
}
}
+ ///
+ /// Reads the data from a as a signed integer value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to an , or if
+ /// there is an array of items.
+ ///
public int ReadSignedInteger(ref TiffIfdEntry entry)
{
if (entry.Count != 1)
@@ -200,6 +230,14 @@ namespace ImageSharp.Formats
}
}
+ ///
+ /// Reads the data from a as an array of unsigned integer values.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a .
+ ///
public uint[] ReadUnsignedIntegerArray(ref TiffIfdEntry entry)
{
byte[] bytes = this.ReadBytes(ref entry);
@@ -244,6 +282,14 @@ namespace ImageSharp.Formats
return result;
}
+ ///
+ /// Reads the data from a as an array of signed integer values.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to an .
+ ///
public int[] ReadSignedIntegerArray(ref TiffIfdEntry entry)
{
byte[] bytes = this.ReadBytes(ref entry);
@@ -288,6 +334,14 @@ namespace ImageSharp.Formats
return result;
}
+ ///
+ /// Reads the data from a as a value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a .
+ ///
public string ReadString(ref TiffIfdEntry entry)
{
if (entry.Type != TiffType.Ascii)
@@ -305,6 +359,15 @@ namespace ImageSharp.Formats
return Encoding.UTF8.GetString(bytes, 0, (int)entry.Count - 1);
}
+ ///
+ /// Reads the data from a as a value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a , or if
+ /// there is an array of items.
+ ///
public Rational ReadUnsignedRational(ref TiffIfdEntry entry)
{
if (entry.Count != 1)
@@ -315,6 +378,15 @@ namespace ImageSharp.Formats
return this.ReadUnsignedRationalArray(ref entry)[0];
}
+ ///
+ /// Reads the data from a as a value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a , or if
+ /// there is an array of items.
+ ///
public SignedRational ReadSignedRational(ref TiffIfdEntry entry)
{
if (entry.Count != 1)
@@ -325,6 +397,14 @@ namespace ImageSharp.Formats
return this.ReadSignedRationalArray(ref entry)[0];
}
+ ///
+ /// Reads the data from a as an array of values.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a .
+ ///
public Rational[] ReadUnsignedRationalArray(ref TiffIfdEntry entry)
{
if (entry.Type != TiffType.Rational)
@@ -338,13 +418,21 @@ namespace ImageSharp.Formats
for (int i = 0; i < result.Length; i++)
{
uint numerator = this.ToUInt32(bytes, i * TiffConstants.SizeOfRational);
- uint denominator = this.ToUInt32(bytes, i * TiffConstants.SizeOfRational + TiffConstants.SizeOfLong);
+ uint denominator = this.ToUInt32(bytes, (i * TiffConstants.SizeOfRational) + TiffConstants.SizeOfLong);
result[i] = new Rational(numerator, denominator);
}
return result;
}
+ ///
+ /// Reads the data from a as an array of values.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a .
+ ///
public SignedRational[] ReadSignedRationalArray(ref TiffIfdEntry entry)
{
if (entry.Type != TiffType.SRational)
@@ -358,13 +446,22 @@ namespace ImageSharp.Formats
for (int i = 0; i < result.Length; i++)
{
int numerator = this.ToInt32(bytes, i * TiffConstants.SizeOfRational);
- int denominator = this.ToInt32(bytes, i * TiffConstants.SizeOfRational + TiffConstants.SizeOfLong);
+ int denominator = this.ToInt32(bytes, (i * TiffConstants.SizeOfRational) + TiffConstants.SizeOfLong);
result[i] = new SignedRational(numerator, denominator);
}
return result;
}
+ ///
+ /// Reads the data from a as a value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a , or if
+ /// there is an array of items.
+ ///
public float ReadFloat(ref TiffIfdEntry entry)
{
if (entry.Count != 1)
@@ -380,6 +477,15 @@ namespace ImageSharp.Formats
return this.ToSingle(entry.Value, 0);
}
+ ///
+ /// Reads the data from a as a value.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a , or if
+ /// there is an array of items.
+ ///
public double ReadDouble(ref TiffIfdEntry entry)
{
if (entry.Count != 1)
@@ -390,6 +496,14 @@ namespace ImageSharp.Formats
return this.ReadDoubleArray(ref entry)[0];
}
+ ///
+ /// Reads the data from a as an array of values.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a .
+ ///
public float[] ReadFloatArray(ref TiffIfdEntry entry)
{
if (entry.Type != TiffType.Float)
@@ -408,6 +522,14 @@ namespace ImageSharp.Formats
return result;
}
+ ///
+ /// Reads the data from a as an array of values.
+ ///
+ /// The to read.
+ /// The data.
+ ///
+ /// Thrown if the data-type specified by the file cannot be converted to a .
+ ///
public double[] ReadDoubleArray(ref TiffIfdEntry entry)
{
if (entry.Type != TiffType.Double)
@@ -426,11 +548,77 @@ namespace ImageSharp.Formats
return result;
}
+ ///
+ /// Calculates the size (in bytes) for the specified TIFF data-type.
+ ///
+ /// The data-type to calculate the size for.
+ /// The size of the data-type (in bytes).
+ private static uint SizeOfDataType(TiffType type)
+ {
+ switch (type)
+ {
+ case TiffType.Byte:
+ case TiffType.Ascii:
+ case TiffType.SByte:
+ case TiffType.Undefined:
+ return 1u;
+ case TiffType.Short:
+ case TiffType.SShort:
+ return 2u;
+ case TiffType.Long:
+ case TiffType.SLong:
+ case TiffType.Float:
+ case TiffType.Ifd:
+ return 4u;
+ case TiffType.Rational:
+ case TiffType.SRational:
+ case TiffType.Double:
+ return 8u;
+ default:
+ return 0u;
+ }
+ }
+
+ ///
+ /// Reads a sequence of bytes from the input stream into a buffer.
+ ///
+ /// A buffer to store the retrieved data.
+ /// The number of bytes to read.
+ private void ReadBytes(byte[] buffer, int count)
+ {
+ int offset = 0;
+
+ while (count > 0)
+ {
+ int bytesRead = this.InputStream.Read(buffer, offset, count);
+
+ if (bytesRead == 0)
+ {
+ break;
+ }
+
+ offset += bytesRead;
+ count -= bytesRead;
+ }
+ }
+
+ ///
+ /// Converts buffer data into an using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private sbyte ToSByte(byte[] bytes, int offset)
{
return (sbyte)bytes[offset];
}
+ ///
+ /// Converts buffer data into an using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private short ToInt16(byte[] bytes, int offset)
{
if (this.IsLittleEndian)
@@ -443,6 +631,12 @@ namespace ImageSharp.Formats
}
}
+ ///
+ /// Converts buffer data into an using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private int ToInt32(byte[] bytes, int offset)
{
if (this.IsLittleEndian)
@@ -455,21 +649,45 @@ namespace ImageSharp.Formats
}
}
+ ///
+ /// Converts buffer data into a using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private byte ToByte(byte[] bytes, int offset)
{
return bytes[offset];
}
+ ///
+ /// Converts buffer data into a using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private uint ToUInt32(byte[] bytes, int offset)
{
return (uint)this.ToInt32(bytes, offset);
}
+ ///
+ /// Converts buffer data into a using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private ushort ToUInt16(byte[] bytes, int offset)
{
return (ushort)this.ToInt16(bytes, offset);
}
+ ///
+ /// Converts buffer data into a using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private float ToSingle(byte[] bytes, int offset)
{
byte[] buffer = new byte[4];
@@ -483,6 +701,12 @@ namespace ImageSharp.Formats
return BitConverter.ToSingle(buffer, 0);
}
+ ///
+ /// Converts buffer data into a using the correct endianness.
+ ///
+ /// The buffer.
+ /// The byte offset within the buffer.
+ /// The converted value.
private double ToDouble(byte[] bytes, int offset)
{
byte[] buffer = new byte[8];
@@ -495,33 +719,5 @@ namespace ImageSharp.Formats
return BitConverter.ToDouble(buffer, 0);
}
-
- public static uint GetSizeOfData(TiffIfdEntry entry) => SizeOfDataType(entry.Type) * entry.Count;
-
- private static uint SizeOfDataType(TiffType type)
- {
- switch (type)
- {
- case TiffType.Byte:
- case TiffType.Ascii:
- case TiffType.SByte:
- case TiffType.Undefined:
- return 1u;
- case TiffType.Short:
- case TiffType.SShort:
- return 2u;
- case TiffType.Long:
- case TiffType.SLong:
- case TiffType.Float:
- case TiffType.Ifd:
- return 4u;
- case TiffType.Rational:
- case TiffType.SRational:
- case TiffType.Double:
- return 8u;
- default:
- return 0u;
- }
- }
}
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffEncoder.cs b/src/ImageSharp/Formats/Tiff/TiffEncoder.cs
index 7193c1a765..c54a43ede4 100644
--- a/src/ImageSharp/Formats/Tiff/TiffEncoder.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffEncoder.cs
@@ -33,8 +33,6 @@ namespace ImageSharp.Formats
where TColor : struct, IPixel
{
throw new NotImplementedException();
- // TiffEncoderCore encode = new TiffEncoderCore(options);
- // encode.Encode(image, stream);
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfd.cs b/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfd.cs
index 40848c4d83..477182c1e1 100644
--- a/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfd.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfd.cs
@@ -6,13 +6,25 @@
namespace ImageSharp.Formats
{
///
- /// Data structure for holding details of each TIFF IFD
+ /// Data structure for holding details of each TIFF IFD.
///
internal struct TiffIfd
{
+ ///
+ /// An array of the entries within this IFD.
+ ///
public TiffIfdEntry[] Entries;
+
+ ///
+ /// Offset (in bytes) to the next IFD, or zero if this is the last IFD.
+ ///
public uint NextIfdOffset;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An array of the entries within the IFD.
+ /// Offset (in bytes) to the next IFD, or zero if this is the last IFD.
public TiffIfd(TiffIfdEntry[] entries, uint nextIfdOffset)
{
this.Entries = entries;
diff --git a/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfdEntry.cs b/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfdEntry.cs
index 04686a4da8..b2983eaade 100644
--- a/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfdEntry.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffIfd/TiffIfdEntry.cs
@@ -6,15 +6,37 @@
namespace ImageSharp.Formats
{
///
- /// Data structure for holding details of each TIFF IFD entry
+ /// Data structure for holding details of each TIFF IFD entry.
///
internal struct TiffIfdEntry
{
+ ///
+ /// The Tag ID for this entry. See for typical values.
+ ///
public ushort Tag;
+
+ ///
+ /// The data-type of this entry.
+ ///
public TiffType Type;
+
+ ///
+ /// The number of array items in this entry, or one if only a single value.
+ ///
public uint Count;
+
+ ///
+ /// The raw byte data for this entry.
+ ///
public byte[] Value;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Tag ID for this entry.
+ /// The data-type of this entry.
+ /// The number of array items in this entry.
+ /// The raw byte data for this entry.
public TiffIfdEntry(ushort tag, TiffType type, uint count, byte[] value)
{
this.Tag = tag;