Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored May 13, 2024
1 parent bfe03df commit c8e4271
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions nQuant.Master/GilbertCurve.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

/* Generalized Hilbert ("gilbert") space-filling curve for rectangular domains of arbitrary (non-power of two) sizes.
Copyright (c) 2021 - 2023 Miller Cy Chan
Expand Down Expand Up @@ -121,7 +120,7 @@ private void DitherPixel(int x, int y)
lookup[offset] = ditherable.DitherColorIndex(palette, c2.ToArgb(), bidx) + 1;
qPixels[bidx] = lookup[offset] - 1;

if(saliencies != null && CIELABConvertor.Y_Diff(pixel, c2) > palette.Length - margin) {
if(saliencies != null && CIELABConvertor.Y_Diff(pixel, c2) > Math.Max(1, palette.Length - margin)) {
var strength = 1 / 3f;
c2 = BlueNoise.Diffuse(pixel, palette[qPixels[bidx]], 1 / saliencies[bidx], strength, x, y);
qPixels[bidx] = ditherable.DitherColorIndex(palette, c2.ToArgb(), bidx);
Expand Down

0 comments on commit c8e4271

Please sign in to comment.