diff --git a/color_convert.py b/color_convert.py index 12b218f..34a43b8 100644 --- a/color_convert.py +++ b/color_convert.py @@ -110,7 +110,7 @@ def resize(im, l): size=(l, l), resample=Image.Resampling.LANCZOS, ) - new.save(f"{l:03}.png") + #new.save(f"{l:03}.png") return new def generate_mips(im): @@ -129,9 +129,10 @@ def write_mip(f, mip: Image, is_twiddled: bool, convert): colors = list(convert_colors(convert, pixels)) assert len(colors) == width * height, len(colors) if is_twiddled: - new_colors = [0] * width * height + npot_height = npot(height) + new_colors = [0] * width * npot_height max_twiddle_ix = twiddle_texture(new_colors, colors, width, height) - assert max_twiddle_ix + 1 == width * height, (max_twiddle_ix, width, height) + #assert max_twiddle_ix + 1 == width * height, (max_twiddle_ix, width, height) colors = new_colors[:max_twiddle_ix+1] pack_colors(f, colors) diff --git a/twiddle.py b/twiddle.py index 7dc9eca..d413569 100644 --- a/twiddle.py +++ b/twiddle.py @@ -49,11 +49,11 @@ def npot(v): return v def texture(dst, src, width, height): - #pot_height = npot(height) + pot_height = npot(height) max_twiddle_ix = -1 for y in range(height): for x in range(width): - twiddle_ix = from_xy(x, y, width, height) + twiddle_ix = from_xy(x, y, width, pot_height) value = src[y * width + x] dst[twiddle_ix] = value if twiddle_ix > max_twiddle_ix: