// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Formats { /// /// Encapsulates the options for the . /// public sealed class JpegEncoderOptions : EncoderOptions, IJpegEncoderOptions { /// /// Initializes a new instance of the class. /// public JpegEncoderOptions() { } /// /// Initializes a new instance of the class. /// /// The options for the encoder. private JpegEncoderOptions(IEncoderOptions options) : base(options) { } /// /// Gets or sets the quality, that will be used to encode the image. Quality /// index must be between 0 and 100 (compression from max to min). /// /// /// If the quality is less than or equal to 90, the subsampling ratio will switch to /// /// The quality of the jpg image from 0 to 100. public int Quality { get; set; } /// /// Gets or sets the subsample ration, that will be used to encode the image. /// /// The subsample ratio of the jpg image. public JpegSubsample? Subsample { get; set; } /// /// Converts the options to a instance with a /// cast or by creating a new instance with the specfied options. /// /// The options for the encoder. /// The options for the . internal static IJpegEncoderOptions Create(IEncoderOptions options) { return options as IJpegEncoderOptions ?? new JpegEncoderOptions(options); } } }