ImgMetadataRemover/ImageCore/Core/LosslessCompressor.cs

35 lines
913 B
C#
Raw Normal View History

using System.IO;
using ImageMagick;
2022-01-22 17:06:10 +00:00
namespace Image.Core
2022-01-22 17:06:10 +00:00
{
2022-01-23 17:30:05 +00:00
/// <summary>
/// LosslessCompressor compresses an image using lossless compression provided by ImageMagick.
/// </summary>
2022-01-22 17:06:10 +00:00
public class LosslessCompressor : ICompressor
{
2022-01-27 21:22:10 +00:00
public static readonly LosslessCompressor Instance = new LosslessCompressor();
2022-01-22 17:06:10 +00:00
private readonly ImageOptimizer _imageOptimizer;
public LosslessCompressor()
{
_imageOptimizer = new ImageOptimizer();
}
2022-01-23 17:30:05 +00:00
/// <summary>
/// <inheritdoc />
/// </summary>
2022-01-22 17:06:10 +00:00
public void Compress(string fileName)
{
_imageOptimizer.LosslessCompress(fileName);
}
/// <summary>
/// <inheritdoc />
/// </summary>
public void Compress(Stream stream)
{
_imageOptimizer.LosslessCompress(stream);
}
2022-01-22 17:06:10 +00:00
}
}