diff --git a/src/ImageProcessor/ImageFactory.cs b/src/ImageProcessor/ImageFactory.cs index b88c3d3bf..4db12e3f7 100644 --- a/src/ImageProcessor/ImageFactory.cs +++ b/src/ImageProcessor/ImageFactory.cs @@ -860,9 +860,9 @@ namespace ImageProcessor int length = filePath.LastIndexOf(".", StringComparison.Ordinal); string extension = this.ImageFormat.GetFileExtension(this.OriginalExtension); - if (!string.IsNullOrWhiteSpace(extension)) + if (length == -1) { - filePath = length == -1 ? filePath + extension : filePath.Substring(0, length) + extension; + filePath = filePath + extension; } // Fix the colour palette of indexed images.