Skip to content

Commit

Permalink
Merge pull request #13 from SagerKudrick/master
Browse files Browse the repository at this point in the history
Update palette.py
  • Loading branch information
hbldh committed Sep 18, 2023
2 parents fa481f9 + 6f48556 commit 0f3bbc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hitherdither/ordered/bayer.py
Expand Up @@ -42,6 +42,8 @@ def I(n, transposed=False):
:return: The index matrix.
"""
if n == 0:
return np.array([[0, 0], [0, 0]], "int")
if n == 2:
if transposed:
return np.array([[0, 3], [2, 1]], "int")
Expand Down
3 changes: 2 additions & 1 deletion hitherdither/palette.py
Expand Up @@ -182,7 +182,8 @@ def median_cut(p, dim=None):
while len(bins) < n:
new_bins = []
for bin in bins:
new_bins += median_cut(bin, dim)
if len(bin) != 0:
new_bins += median_cut(bin, dim)
bins = new_bins

# Average over pixels in each bin to create
Expand Down

0 comments on commit 0f3bbc4

Please sign in to comment.