From 2e26ea09efebdc36ede6438ff1cdeff69aee256e Mon Sep 17 00:00:00 2001 From: David Mays <88937419+dmays-io@users.noreply.github.com> Date: Thu, 15 Jun 2023 20:57:53 -0400 Subject: [PATCH] fix casting of offset to float which breaks indexing --- error_diffusion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/error_diffusion.py b/error_diffusion.py index 788e9d2..3d0dd43 100644 --- a/error_diffusion.py +++ b/error_diffusion.py @@ -82,7 +82,7 @@ def _error_diffusion(image_matrix, palette_name, diffusion_matrix): new_matrix[x + (ci + 1)][y] += quant_error * coeff for di, downward_diffusion in enumerate(diffusion_matrix[1:]): if y + di + 1 < rows: - offset = len(downward_diffusion) / 2 + offset = int(len(downward_diffusion) / 2) for ci, coeff in enumerate(downward_diffusion): if 0 <= x + ci - offset < cols: new_matrix[x + ci - offset][y + di + 1] += quant_error * coeff