diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs index cde893b48..2ddd829f8 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs @@ -15,7 +15,7 @@ public sealed class JpegEncoder : ImageEncoder /// /// Gets the quality, that will be used to encode the image. Quality - /// index must be between 0 and 100 (compression from max to min). + /// index must be between 1 and 100 (compression from max to min). /// Defaults to 75. /// /// Quality factor must be in [1..100] range. diff --git a/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs b/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs index 7be36014c..33b968b99 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Diagnostics; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -86,7 +87,8 @@ public class DefaultPixelSamplingStrategy : IPixelSamplingStrategy for (int pos = 0; pos < totalNumberOfRows; pos++) { - int subPos = pos % denom; + Debug.Assert(denom > 0, "Denominator must be greater than zero."); + int subPos = (int)((uint)pos % (uint)denom); if (subPos < num) { yield return GetRow(pos); @@ -137,7 +139,7 @@ public class DefaultPixelSamplingStrategy : IPixelSamplingStrategy for (int pos = 0; pos < totalNumberOfRows; pos++) { - Debug.Assert(denom > 0); + Debug.Assert(denom > 0, "Denominator must be greater than zero."); int subPos = (int)((uint)pos % (uint)denom); if (subPos < num) {