File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
src/Magick.NET/ImageOptimizers Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change 11// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
22// Licensed under the Apache License, Version 2.0.
33
4- using System . Collections . Generic ;
54using System . Collections . ObjectModel ;
65using System . IO ;
6+ using System . Linq ;
77using ImageMagick . ImageOptimizers ;
88
99namespace ImageMagick ;
@@ -27,21 +27,6 @@ public sealed class ImageOptimizer
2727 /// </summary>
2828 public bool OptimalCompression { get ; set ; }
2929
30- private string SupportedFormats
31- {
32- get
33- {
34- var formats = new List < string > ( _optimizers . Count ) ;
35-
36- foreach ( var optimizer in _optimizers )
37- {
38- formats . Add ( optimizer . Format . ModuleFormat . ToString ( ) ) ;
39- }
40-
41- return string . Join ( ", " , formats . ToArray ( ) ) ;
42- }
43- }
44-
4530 /// <summary>
4631 /// Performs compression on the specified file. With some formats the image will be decoded
4732 /// and encoded and this will result in a small quality reduction. If the new file size is not
@@ -241,6 +226,7 @@ private bool DoCompress(FileInfo file)
241226 if ( IgnoreUnsupportedFormats )
242227 return null ;
243228
244- throw new MagickCorruptImageErrorException ( "Invalid format, supported formats are: " + SupportedFormats ) ;
229+ var supportedFormats = string . Join ( ", " , _optimizers . Select ( imageOptizimer => imageOptizimer . Format . ModuleFormat . ToString ( ) ) ) ;
230+ throw new MagickCorruptImageErrorException ( $ "Invalid format, supported formats are: { supportedFormats } ") ;
245231 }
246232}
You can’t perform that action at this time.
0 commit comments