diff --git a/src/ImageSharp/Image/Image.FromBytes.cs b/src/ImageSharp/Image/Image.FromBytes.cs index 9da9c5e43..44c53d776 100644 --- a/src/ImageSharp/Image/Image.FromBytes.cs +++ b/src/ImageSharp/Image/Image.FromBytes.cs @@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp /// The format or null if none found. public static IImageFormat DetectFormat(byte[] data) { - return DetectFormat(null, data); + return DetectFormat(Configuration.Default, data); } /// @@ -41,7 +41,7 @@ namespace SixLabors.ImageSharp /// /// The byte array containing image data. /// A new . - public static Image Load(byte[] data) => Load(null, data); + public static Image Load(byte[] data) => Load(Configuration.Default, data); /// /// Create a new instance of the class from the given byte array. @@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp /// The byte array containing image data. /// The mime type of the decoded image. /// A new . - public static Image Load(byte[] data, out IImageFormat format) => Load(null, data, out format); + public static Image Load(byte[] data, out IImageFormat format) => Load(Configuration.Default, data, out format); /// /// Create a new instance of the class from the given byte array. @@ -93,9 +93,7 @@ namespace SixLabors.ImageSharp /// A new . public static Image Load(byte[] data) where TPixel : struct, IPixel - { - return Load(null, data); - } + => Load(Configuration.Default, data); /// /// Create a new instance of the class from the given byte array. @@ -106,9 +104,7 @@ namespace SixLabors.ImageSharp /// A new . public static Image Load(byte[] data, out IImageFormat format) where TPixel : struct, IPixel - { - return Load(null, data, out format); - } + => Load(Configuration.Default, data, out format); /// /// Create a new instance of the class from the given byte array. diff --git a/src/ImageSharp/Image/Image.FromFile.cs b/src/ImageSharp/Image/Image.FromFile.cs index 0474a6d47..ad8f3426f 100644 --- a/src/ImageSharp/Image/Image.FromFile.cs +++ b/src/ImageSharp/Image/Image.FromFile.cs @@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp /// The mime type or null if none found. public static IImageFormat DetectFormat(string filePath) { - return DetectFormat(null, filePath); + return DetectFormat(Configuration.Default, filePath); } /// @@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp public static Image Load(string path) where TPixel : struct, IPixel { - return Load(null, path); + return Load(Configuration.Default, path); } /// @@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp public static Image Load(string path, out IImageFormat format) where TPixel : struct, IPixel { - return Load(null, path, out format); + return Load(Configuration.Default, path, out format); } /// @@ -150,7 +150,6 @@ namespace SixLabors.ImageSharp public static Image Load(Configuration config, string path) where TPixel : struct, IPixel { - config = config ?? Configuration.Default; using (Stream stream = config.FileSystem.OpenRead(path)) { return Load(config, stream); @@ -171,7 +170,6 @@ namespace SixLabors.ImageSharp public static Image Load(Configuration config, string path, out IImageFormat format) where TPixel : struct, IPixel { - config = config ?? Configuration.Default; using (Stream stream = config.FileSystem.OpenRead(path)) { return Load(config, stream, out format); @@ -191,7 +189,7 @@ namespace SixLabors.ImageSharp public static Image Load(string path, IImageDecoder decoder) where TPixel : struct, IPixel { - return Load(null, path, decoder); + return Load(Configuration.Default, path, decoder); } /// @@ -208,7 +206,6 @@ namespace SixLabors.ImageSharp public static Image Load(Configuration config, string path, IImageDecoder decoder) where TPixel : struct, IPixel { - config = config ?? Configuration.Default; using (Stream stream = config.FileSystem.OpenRead(path)) { return Load(config, stream, decoder);