Add progress bar for NDPI to DZI conversion and update .gitignore

This commit is contained in:
Benedikt Willi 2026-03-10 15:10:05 +01:00
parent 013af37f66
commit 100931dce1
2 changed files with 22 additions and 7 deletions

2
.gitignore vendored
View file

@ -160,3 +160,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
output/

View file

@ -24,7 +24,20 @@ def convert_ndpi_to_dzi(
except pyvips.Error as exc:
raise click.ClickException(f"Failed to open '{input_ndpi}': {exc}") from exc
image.set_progress(True)
try:
with click.progressbar(length=100, label="Converting") as bar:
last_percent = [0]
def eval_cb(_image, progress):
delta = progress.percent - last_percent[0]
if delta > 0:
bar.update(delta)
last_percent[0] = progress.percent
image.signal_connect("eval", eval_cb)
image.dzsave(
output,
suffix=f".jpeg[Q={quality}]",