Browse Source

Throw Exception, if StripOffsets or StripByteCounts is missing

pull/1570/head
Brian Popow 5 years ago
parent
commit
b6ce06d5ff
  1. 28
      src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs

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

@ -194,7 +194,19 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
/// <summary> /// <summary>
/// Gets for each strip, the byte offset of that strip. /// Gets for each strip, the byte offset of that strip.
/// </summary> /// </summary>
public Number[] StripOffsets => this.ExifProfile.GetValue(ExifTag.StripOffsets).Value; public Number[] StripOffsets
{
get
{
IExifValue<Number[]> stripOffsets = this.ExifProfile.GetValue(ExifTag.StripOffsets);
if (stripOffsets == null)
{
TiffThrowHelper.ThrowImageFormatException("StripOffsets are missing");
}
return stripOffsets.Value;
}
}
/// <summary> /// <summary>
/// Gets the number of components per pixel. /// Gets the number of components per pixel.
@ -221,7 +233,19 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
/// <summary> /// <summary>
/// Gets for each strip, the number of bytes in the strip after compression. /// Gets for each strip, the number of bytes in the strip after compression.
/// </summary> /// </summary>
public Number[] StripByteCounts => this.ExifProfile.GetValue(ExifTag.StripByteCounts).Value; public Number[] StripByteCounts
{
get
{
IExifValue<Number[]> stripByteCounts = this.ExifProfile.GetValue(ExifTag.StripByteCounts);
if (stripByteCounts == null)
{
TiffThrowHelper.ThrowImageFormatException("StripByteCounts are missing");
}
return stripByteCounts.Value;
}
}
/// <summary> /// <summary>
/// Gets the resolution of the image in x- direction. /// Gets the resolution of the image in x- direction.

Loading…
Cancel
Save