//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Formats
{
using System.Collections.Generic;
///
/// Encapsulates the means to encode and decode Tiff images.
///
public class TiffFormat : IImageFormat
{
///
public string MimeType => "image/tiff";
///
public string Extension => "tif";
///
public IEnumerable SupportedExtensions => new string[] { "tif", "tiff" };
///
public IImageDecoder Decoder => new TiffDecoder();
///
public IImageEncoder Encoder => throw new System.NotImplementedException();
///
public int HeaderSize => 4;
///
public bool IsSupportedFileFormat(byte[] header)
{
return header.Length >= this.HeaderSize &&
((header[0] == 0x49 && header[1] == 0x49 && header[2] == 0x2A && header[3] == 0x00) || // Little-endian
(header[0] == 0x4D && header[1] == 0x4D && header[2] == 0x00 && header[3] == 0x2A)); // Big-endian
}
}
}