using ImageMagick;
using Ocr.Tesseract.Extensions;

namespace Ocr.Tesseract.Screenshots;

public class ResizeProcessor : SingleImageProcessor
{
  private readonly FilterType _filterType;
  private readonly PixelInterpolateMethod _interpolateMethod;

  public ResizeProcessor(FilterType filterType, PixelInterpolateMethod interpolateMethod)
  {
    _filterType = filterType;
    _interpolateMethod = interpolateMethod;
  }

  #region Overrides of Processor<MagickImage,MagickImage>

  protected override MagickImage Process(MagickImage image) => image
    .ResizeImage(
      2f,
      _filterType,
      _interpolateMethod
    )
    .Resample(300, DensityUnit.PixelsPerInch);

  #endregion
}