Browse Source

Add sampler option, add comment.

pull/2180/head
James Jackson-South 4 years ago
parent
commit
0e13e6c96c
  1. 7
      src/ImageSharp/Formats/DecoderOptions.cs
  2. 2
      src/ImageSharp/Formats/ImageDecoderUtilities.cs
  3. 4
      src/ImageSharp/Formats/Jpeg/JpegDecoderResizeMode.cs

7
src/ImageSharp/Formats/DecoderOptions.cs

@ -2,6 +2,8 @@
// Licensed under the Six Labors Split License.
using System;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
namespace SixLabors.ImageSharp.Formats
{
@ -29,6 +31,11 @@ namespace SixLabors.ImageSharp.Formats
/// </summary>
public Size? TargetSize { get; set; } = null;
/// <summary>
/// Gets or sets the sampler to use when resizing during decoding.
/// </summary>
public IResampler Sampler { get; set; } = KnownResamplers.Box;
/// <summary>
/// Gets or sets a value indicating whether to ignore encoded metadata when decoding.
/// </summary>

2
src/ImageSharp/Formats/ImageDecoderUtilities.cs

@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Formats
ResizeOptions resizeOptions = new()
{
Size = options.TargetSize.Value,
Sampler = KnownResamplers.Box,
Sampler = options.Sampler,
Mode = ResizeMode.Max
};

4
src/ImageSharp/Formats/Jpeg/JpegDecoderResizeMode.cs

@ -1,6 +1,8 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing;
namespace SixLabors.ImageSharp.Formats.Jpeg
{
/// <summary>
@ -15,7 +17,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
Combined,
/// <summary>
/// IDCT-only to nearest block scale.
/// IDCT-only to nearest block scale. Similar in output to <see cref="KnownResamplers.Box"/>.
/// </summary>
IdctOnly,

Loading…
Cancel
Save