diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs index 6b6dc6e21..1dededae4 100644 --- a/src/ImageSharp/Image.Decode.cs +++ b/src/ImageSharp/Image.Decode.cs @@ -101,6 +101,22 @@ namespace SixLabors.ImageSharp : null; } + /// + /// By reading the header on the provided stream this calculates the images format. + /// + /// The image stream to read the header from. + /// The configuration. + /// The IImageFormat. + /// The image format or null if none found. + private static async Task DiscoverDecoderAsync(Stream stream, Configuration config, out IImageFormat format) + { + format = await InternalDetectFormatAsync(stream, config).ConfigureAwait(false); + + return format != null + ? config.ImageFormatsManager.FindDecoder(format) + : null; + } + /// /// Decodes the image stream to the current image. ///