Swap optimization steps: convert to monochrome before trimming whitespace. Include uv.lock in the commit.

This commit is contained in:
Esa Kataja
2024-12-03 23:41:40 +02:00
parent a2f88923ab
commit 825338a2a3
2 changed files with 13 additions and 13 deletions
+12 -12
View File
@@ -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():
Generated
+1 -1
View File
@@ -33,7 +33,7 @@ wheels = [
[[package]]
name = "notes-cleaner"
version = "0.1.0"
version = "0.9rc2"
source = { virtual = "." }
dependencies = [
{ name = "click" },