using SixLabors.ImageSharp.Formats; using System; using System.Threading; using System.Threading.Tasks; namespace Timeline.Services.Imaging { public interface IImageService { /// /// Detect the format of a image. /// /// /// /// The image format. /// Thrown when is null. /// Thrown when image data can't be detected. Task DetectFormatAsync(byte[] data, CancellationToken cancellationToken = default); /// /// Validate a image data. /// /// The data of the image. Can't be null. /// If not null, the real image format will be check against the requested format and throw if not match. If null, then do not check. /// If true, image must be square. /// Cancellation token. /// The format. /// Thrown when is null. /// Thrown when image data can't be decoded or real type does not match request type or image is not square when required. Task ValidateAsync(byte[] data, string? requestType = null, bool square = false, CancellationToken cancellationToken = default); } }