Skip to content

Commit f85b686

Browse files
committed
Use this.maxColors when getting size of the reduced palette, fixes #1505
1 parent 5ab593f commit f85b686

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Numerics;
77
using System.Runtime.CompilerServices;
88
using System.Runtime.InteropServices;
9-
using SixLabors.ImageSharp.Advanced;
109
using SixLabors.ImageSharp.Memory;
1110
using SixLabors.ImageSharp.PixelFormats;
1211

@@ -96,7 +95,7 @@ public void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion)
9695
this.octree.Palletize(paletteSpan, this.maxColors, ref paletteIndex);
9796

9897
// Length of reduced palette + transparency.
99-
ReadOnlyMemory<TPixel> result = this.paletteOwner.Memory.Slice(0, Math.Min(paletteIndex + 2, QuantizerConstants.MaxColors));
98+
ReadOnlyMemory<TPixel> result = this.paletteOwner.Memory.Slice(0, Math.Min(paletteIndex + 2, this.maxColors));
10099
this.pixelMap = new EuclideanPixelMap<TPixel>(this.Configuration, result);
101100

102101
this.palette = result;

0 commit comments

Comments
 (0)