diff --git a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs index 185ac9cc4..61dfc8944 100644 --- a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs +++ b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs @@ -18,16 +18,16 @@ namespace SixLabors.ImageSharp.Advanced public static class AdvancedImageExtensions { /// - /// For a given path find the best encoder to use + /// For a given file path find the best encoder to use via its extension. /// - /// The source. - /// The Path + /// The source image. + /// The target file path to save the image to. /// The matching encoder. - public static IImageEncoder FindEncoded(this Image source, string path) + public static IImageEncoder DetectEncoder(this Image source, string filePath) { - Guard.NotNull(path, nameof(path)); + Guard.NotNull(filePath, nameof(filePath)); - string ext = Path.GetExtension(path); + string ext = Path.GetExtension(filePath); IImageFormat format = source.GetConfiguration().ImageFormatsManager.FindFormatByFileExtension(ext); if (format is null) { @@ -62,8 +62,8 @@ namespace SixLabors.ImageSharp.Advanced /// Accepts a to implement a double-dispatch pattern in order to /// apply pixel-specific operations on non-generic instances /// - /// The source. - /// The visitor. + /// The source image. + /// The image visitor. public static void AcceptVisitor(this Image source, IImageVisitor visitor) => source.Accept(visitor); @@ -71,8 +71,8 @@ namespace SixLabors.ImageSharp.Advanced /// Accepts a to implement a double-dispatch pattern in order to /// apply pixel-specific operations on non-generic instances /// - /// The source. - /// The visitor. + /// The source image. + /// The image visitor. /// A representing the asynchronous operation. public static async Task AcceptVisitorAsync(this Image source, IImageVisitorAsync visitor) => await source.AcceptAsync(visitor).ConfigureAwait(false); diff --git a/src/ImageSharp/ImageExtensions.cs b/src/ImageSharp/ImageExtensions.cs index df2c12106..a04688e5a 100644 --- a/src/ImageSharp/ImageExtensions.cs +++ b/src/ImageSharp/ImageExtensions.cs @@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp /// The file path to save the image to. /// The path is null. public static void Save(this Image source, string path) - => source.Save(path, source.FindEncoded(path)); + => source.Save(path, source.DetectEncoder(path)); /// /// Writes the image to the given stream using the currently loaded image format. @@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// A representing the asynchronous operation. public static Task SaveAsync(this Image source, string path) - => source.SaveAsync(path, source.FindEncoded(path)); + => source.SaveAsync(path, source.DetectEncoder(path)); /// /// Writes the image to the given stream using the currently loaded image format. diff --git a/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs b/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs index a327861ca..0aba932ce 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.SaveAsync.cs @@ -95,7 +95,7 @@ namespace SixLabors.ImageSharp.Tests { using (var image = new Image(5, 5)) { - IImageEncoder encoder = image.FindEncoded(filename); + IImageEncoder encoder = image.DetectEncoder(filename); using (var stream = new MemoryStream()) { var asyncStream = new AsyncStreamWrapper(stream, () => false);