2022-01-22 17:06:10 +00:00
|
|
|
|
using ImageMagick;
|
|
|
|
|
|
2022-01-25 20:57:22 +00:00
|
|
|
|
namespace Image.Compressor
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|