Prerequisites
Description
When I trying to quantize image from MemoryStream (which filled from System.Drawing.Bitmap), this exception throws:
ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at SixLabors.ImageSharp.Processing.Processors.Quantization.OctreeQuantizer`1.AddPaletteColors(Buffer2DRegion`1 pixelRegion)
at SixLabors.ImageSharp.Processing.Processors.Quantization.QuantizerUtilities.BuildPaletteAndQuantizeFrame[TPixel](IQuantizer`1 quantizer, ImageFrame`1 source, Rectangle bounds)
at SixLabors.ImageSharp.Processing.Processors.Quantization.QuantizeProcessor`1.OnFrameApply(ImageFrame`1 source)
at SixLabors.ImageSharp.Processing.Processors.ImageProcessor`1.Apply(ImageFrame`1 source)
Steps to Reproduce
- Load image from MemoryStream, filled from this Bitmap
(img.PixelFormat is PixelFormat.Format32bppArgb):
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgba32> imgIS;
using (MemoryStream memoryStream = new MemoryStream())
{
img.Save(memoryStream, ImageFormat.Png);
memoryStream.Seek(0, SeekOrigin.Begin);
imgIS = SixLabors.ImageSharp.Image.Load<SixLabors.ImageSharp.PixelFormats.Rgba32>(memoryStream, new SixLabors.ImageSharp.Formats.Png.PngDecoder());
}
- Quantize it.
SixLabors.ImageSharp.Processing.Processors.Quantization.IQuantizer quantizer = new SixLabors.ImageSharp.Processing.Processors.Quantization.OctreeQuantizer(new SixLabors.ImageSharp.Processing.Processors.Quantization.QuantizerOptions { MaxColors = 81 });
imgIS.Mutate(x => x.Quantize(quantizer));
One detail: I am using ImageSharp without using SixLabors.ImageSharp;, only using SixLabors.ImageSharp.Processing;
System Configuration
- SixLabors.ImageSharp version - 1.0.2:
- Environment: Windows 7 Ultimate SP1 x64.
- .NET Framework version: 4.8.03761; .NET version - 5.0.101 (project uses .NET 5.0).
- Additional information: Microsoft Visual Studio Community 2019, version 16.8.3.
Prerequisites
DEBUGandRELEASEmodeDescription
When I trying to quantize image from MemoryStream (which filled from System.Drawing.Bitmap), this exception throws:
Steps to Reproduce
img.PixelFormatisPixelFormat.Format32bppArgb):One detail: I am using ImageSharp without
using SixLabors.ImageSharp;, onlyusing SixLabors.ImageSharp.Processing;System Configuration