diff --git a/pdf_cleaner.py b/pdf_cleaner.py index ceaa31f..13fd1f0 100755 --- a/pdf_cleaner.py +++ b/pdf_cleaner.py @@ -323,18 +323,7 @@ def optimize(level): print(f"Processing {total_files} images at optimization level {level}...") - # Step 1: Always trim whitespace - print("\nTrimming whitespace from images...") - for i, file_path in enumerate(temp_files, 1): - print(f"[{i}/{total_files}] Processing {os.path.basename(file_path)}...", end='', flush=True) - # Only optimize if this is the final step (level 1) - if trim_whitespace(file_path, is_final=(opt_level == OptimizationLevel.TRIM)): - successful['trim'] += 1 - print(" ") - else: - print(" ") - - # Step 2: Convert to monochrome if level >= 2 + # Step 1: Convert to monochrome if level >= 2 if int(opt_level) >= int(OptimizationLevel.MONOCHROME): print("\nConverting to monochrome...") for i, file_path in enumerate(temp_files, 1): @@ -346,6 +335,17 @@ def optimize(level): else: print(" ") + # Step 2: Always trim whitespace + print("\nTrimming whitespace from images...") + for i, file_path in enumerate(temp_files, 1): + print(f"[{i}/{total_files}] Processing {os.path.basename(file_path)}...", end='', flush=True) + # Only optimize if this is the final step (level 1) + if trim_whitespace(file_path, is_final=(opt_level == OptimizationLevel.TRIM)): + successful['trim'] += 1 + print(" ") + else: + print(" ") + # Step 3: Run optipng if level = 3 if opt_level == OptimizationLevel.FULL: if check_optipng_installed(): diff --git a/uv.lock b/uv.lock index d9bf036..e8c7af7 100644 --- a/uv.lock +++ b/uv.lock @@ -33,7 +33,7 @@ wheels = [ [[package]] name = "notes-cleaner" -version = "0.1.0" +version = "0.9rc2" source = { virtual = "." } dependencies = [ { name = "click" },