/// <summary>
        /// Returns true when the supplied stream is supported.
        /// </summary>
        /// <param name="stream">The stream to check.</param>
        /// <returns>True when the supplied stream is supported.</returns>
        public bool IsSupported(Stream stream)
        {
            Throw.IfNull(nameof(stream), stream);

            if (!stream.CanRead || !stream.CanWrite || !stream.CanSeek)
            {
                return(false);
            }

            return(IsSupported(ImageOptimizerHelper.GetFormatInformation(stream)));
        }
        private IImageOptimizer GetOptimizer(Stream stream)
        {
            var info = ImageOptimizerHelper.GetFormatInformation(stream);

            return(GetOptimizer(info));
        }
        private IImageOptimizer GetOptimizer(FileInfo file)
        {
            var info = ImageOptimizerHelper.GetFormatInformation(file);

            return(GetOptimizer(info));
        }
 /// <summary>
 /// Returns true when the supplied file name is supported based on the extension of the file.
 /// </summary>
 /// <param name="fileName">The name of the file to check.</param>
 /// <returns>True when the supplied file name is supported based on the extension of the file.</returns>
 public bool IsSupported(string fileName) => IsSupported(ImageOptimizerHelper.GetFormatInformation(fileName));
 /// <summary>
 /// Returns true when the supplied file name is supported based on the extension of the file.
 /// </summary>
 /// <param name="file">The file to check.</param>
 /// <returns>True when the supplied file name is supported based on the extension of the file.</returns>
 /// <returns>True when the image could be compressed otherwise false.</returns>
 public bool IsSupported(FileInfo file) => IsSupported(ImageOptimizerHelper.GetFormatInformation(file));