diff --git a/src/ImageProcessor/Imaging/Formats/BitmapFormat.cs b/src/ImageProcessor/Imaging/Formats/BitmapFormat.cs
index cf754e202..b971f276e 100644
--- a/src/ImageProcessor/Imaging/Formats/BitmapFormat.cs
+++ b/src/ImageProcessor/Imaging/Formats/BitmapFormat.cs
@@ -21,11 +21,11 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- public override byte[][] FileHeaders
+ public override byte[] FileHeader
{
get
{
- return new[] { Encoding.ASCII.GetBytes("BM") };
+ return Encoding.ASCII.GetBytes("BM");
}
}
diff --git a/src/ImageProcessor/Imaging/Formats/FormatBase.cs b/src/ImageProcessor/Imaging/Formats/FormatBase.cs
index 0f317ba0c..de590aea2 100644
--- a/src/ImageProcessor/Imaging/Formats/FormatBase.cs
+++ b/src/ImageProcessor/Imaging/Formats/FormatBase.cs
@@ -23,7 +23,7 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- public abstract byte[][] FileHeaders { get; }
+ public abstract byte[] FileHeader { get; }
///
/// Gets the list of file extensions.
diff --git a/src/ImageProcessor/Imaging/Formats/FormatUtilities.cs b/src/ImageProcessor/Imaging/Formats/FormatUtilities.cs
index 7a87ad400..d3b6f9c56 100644
--- a/src/ImageProcessor/Imaging/Formats/FormatUtilities.cs
+++ b/src/ImageProcessor/Imaging/Formats/FormatUtilities.cs
@@ -43,15 +43,11 @@ namespace ImageProcessor.Imaging.Formats
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (ISupportedImageFormat supportedImageFormat in supportedImageFormats)
{
- byte[][] headers = supportedImageFormat.FileHeaders;
-
- foreach (byte[] header in headers)
+ byte[] header = supportedImageFormat.FileHeader;
+ if (header.SequenceEqual(buffer.Take(header.Length)))
{
- if (header.SequenceEqual(buffer.Take(header.Length)))
- {
- stream.Position = 0;
- return supportedImageFormat;
- }
+ stream.Position = 0;
+ return supportedImageFormat;
}
}
diff --git a/src/ImageProcessor/Imaging/Formats/GifFormat.cs b/src/ImageProcessor/Imaging/Formats/GifFormat.cs
index 45d966f8f..87c9a0d30 100644
--- a/src/ImageProcessor/Imaging/Formats/GifFormat.cs
+++ b/src/ImageProcessor/Imaging/Formats/GifFormat.cs
@@ -25,11 +25,11 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- public override byte[][] FileHeaders
+ public override byte[] FileHeader
{
get
{
- return new[] { Encoding.ASCII.GetBytes("GIF") };
+ return Encoding.ASCII.GetBytes("GIF");
}
}
diff --git a/src/ImageProcessor/Imaging/Formats/ISupportedImageFormat.cs b/src/ImageProcessor/Imaging/Formats/ISupportedImageFormat.cs
index 4296b1e58..8ad4e0763 100644
--- a/src/ImageProcessor/Imaging/Formats/ISupportedImageFormat.cs
+++ b/src/ImageProcessor/Imaging/Formats/ISupportedImageFormat.cs
@@ -23,7 +23,7 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- byte[][] FileHeaders { get; }
+ byte[] FileHeader { get; }
///
/// Gets the list of file extensions.
diff --git a/src/ImageProcessor/Imaging/Formats/JpegFormat.cs b/src/ImageProcessor/Imaging/Formats/JpegFormat.cs
index 161ebe2e2..78265d458 100644
--- a/src/ImageProcessor/Imaging/Formats/JpegFormat.cs
+++ b/src/ImageProcessor/Imaging/Formats/JpegFormat.cs
@@ -25,18 +25,11 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- public override byte[][] FileHeaders
+ public override byte[] FileHeader
{
get
{
- return new[]
- {
- new byte[] { 255, 216, 255, 232 },
- new byte[] { 255, 216, 255, 227 },
- new byte[] { 255, 216, 255, 226 },
- new byte[] { 255, 216, 255, 224 },
- new byte[] { 255, 216, 255, 225 }
- };
+ return new byte[] { 255, 216, 255 };
}
}
diff --git a/src/ImageProcessor/Imaging/Formats/PngFormat.cs b/src/ImageProcessor/Imaging/Formats/PngFormat.cs
index b3c13cc37..da6b4dc5f 100644
--- a/src/ImageProcessor/Imaging/Formats/PngFormat.cs
+++ b/src/ImageProcessor/Imaging/Formats/PngFormat.cs
@@ -22,11 +22,11 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- public override byte[][] FileHeaders
+ public override byte[] FileHeader
{
get
{
- return new[] { new byte[] { 137, 80, 78, 71 } };
+ return new byte[] { 137, 80, 78, 71 };
}
}
diff --git a/src/ImageProcessor/Imaging/Formats/TiffFormat.cs b/src/ImageProcessor/Imaging/Formats/TiffFormat.cs
index 1b12cc80a..226c0efab 100644
--- a/src/ImageProcessor/Imaging/Formats/TiffFormat.cs
+++ b/src/ImageProcessor/Imaging/Formats/TiffFormat.cs
@@ -23,11 +23,11 @@ namespace ImageProcessor.Imaging.Formats
///
/// Gets the file header.
///
- public override byte[][] FileHeaders
+ public override byte[] FileHeader
{
get
{
- return new[] { new byte[] { 77, 77, 42 } };
+ return new byte[] { 77, 77, 42 };
}
}