Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85876228eb | |||
| f498cafdf3 | |||
| f0d07dab4b | |||
| de9c9ad48c |
@@ -1,6 +1,6 @@
|
||||
|
||||
# PPTX Image Compressor (CaesiumCLT only)
|
||||
**Version 1.1.3**
|
||||
**Version 1.1.4**
|
||||
|
||||
Dieses Paket enthält:
|
||||
|
||||
@@ -32,14 +32,13 @@ Die Batch lädt bei Bedarf automatisch das **Windows Embeddable Python Package**
|
||||
|
||||
## Was das Tool macht
|
||||
- Entpackt die PPTX in einen Temp‑Ordner
|
||||
- Komprimiert **JPG/JPEG, PNG, WebP** mit **CaesiumCLT** (Default `-q 90`, `-O bigger`)
|
||||
- Komprimiert **JPG/JPEG, PNG, WebP, GIF** mit **CaesiumCLT** (Default `-q 90`, `-O bigger`)
|
||||
- Ersetzt Bilder nur, wenn die komprimierte Datei kleiner ist
|
||||
- Schreibt ein CSV‑Log (`.log` neben der Output‑PPTX)
|
||||
- Baut eine neue PPTX und zeigt eine Summary (Name, Größe vorher/nachher, Ersparnis %, Zeit)
|
||||
- Räumt alle temporären Dateien auf (keine Caesium‑Tempfiles in der finalen PPTX)
|
||||
|
||||
## Hinweise
|
||||
- **GIF** wird übersprungen (keine Rekodierung).
|
||||
- `-t` steuert die Parallelität der Python‑Threads; intern wird `caesiumclt --threads 1` gesetzt, sobald `-t > 1`, um Oversubscription zu vermeiden. Default ist 16
|
||||
- `-q` steuert das Qualitätslevel; intern wird `caesiumclt -q` mit diesem Wert von `0..100` benutzt, Default ist 90
|
||||
- Die Batch **verwendet bevorzugt das Embeddable Python** neben der BAT; ansonsten sucht sie echte `python.exe`/`py.exe` im PATH, **ignoriert** aber die Microsoft‑Store‑Alias‑Pfade (`WindowsApps`).
|
||||
|
||||
Binary file not shown.
@@ -12,7 +12,7 @@ set "SELF_DIR=%~dp0"
|
||||
set "SCRIPT=%SELF_DIR%pptx_image_compress.py"
|
||||
|
||||
rem ---- Python Embeddable config ----
|
||||
set "PY_EMBED_VERSION=3.13.7"
|
||||
set "PY_EMBED_VERSION=3.13.9"
|
||||
set "PY_EMBED_ZIP=python-%PY_EMBED_VERSION%-embed-amd64.zip"
|
||||
set "PY_EMBED_URL=https://www.python.org/ftp/python/%PY_EMBED_VERSION%/%PY_EMBED_ZIP%"
|
||||
set "PY_DIR=%SELF_DIR%python-embed"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
PPTX Grafik-Komprimier-Tool (nur CaesiumCLT, Multi-Thread, Batch, sauberes Cleanup)
|
||||
Version: 1.1.3
|
||||
Version: 1.1.4
|
||||
|
||||
|
||||
Highlights:
|
||||
@@ -12,8 +12,8 @@ Highlights:
|
||||
- Log: image_name,size_before,size_after,saving,saving_percent
|
||||
- Summary inkl. Zeit benötigt
|
||||
|
||||
Änderungen in 1.1.3:
|
||||
- Changed all UNICODE Chars to ASCII
|
||||
Änderungen in 1.1.4:
|
||||
- Libcaesium 1.1.0 kann nun auch gif verkleinern
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@@ -31,9 +31,9 @@ from datetime import timedelta
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from threading import Lock
|
||||
|
||||
__version__ = "1.1.3"
|
||||
__version__ = "1.1.4"
|
||||
|
||||
ALLOWED_EXT = {".jpg", ".jpeg", ".png", ".webp", ".gif"} # GIF wird übersprungen
|
||||
ALLOWED_EXT = {".jpg", ".jpeg", ".png", ".webp", ".gif"}
|
||||
PROGRESS_BAR_LEN = 40
|
||||
TEMP_PREFIX = "pptx_compress_"
|
||||
|
||||
@@ -91,7 +91,7 @@ def compress_with_caesium(original: Path, out_dir: Path, caesium_threads: int |
|
||||
raise RuntimeError("[ERROR] 'caesiumclt' wurde nicht gefunden. Bitte CaesiumCLT installieren und in PATH verfügbar machen.")
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
ext = original.suffix.lower()
|
||||
if ext not in {".jpg", ".jpeg", ".png", ".webp"}:
|
||||
if ext not in {".jpg", ".jpeg", ".png", ".webp", ".gif"}:
|
||||
return None
|
||||
cmd = [exe, "-q", str(quality), "-O", "bigger", "-o", str(out_dir)]
|
||||
if caesium_threads is not None:
|
||||
@@ -173,12 +173,6 @@ def process_single_deck(input_pptx: Path, output_pptx: Path, threads: int, quali
|
||||
nonlocal done_count
|
||||
ext = img_path.suffix.lower()
|
||||
orig_size = img_path.stat().st_size
|
||||
if ext == ".gif":
|
||||
with lock:
|
||||
done_count += 1
|
||||
log_lines.append(f"{img_path.name};{human_kb(orig_size)};{human_kb(orig_size)};0;0.0\n")
|
||||
print_progress(done_count, total)
|
||||
return
|
||||
chosen_size = orig_size
|
||||
try:
|
||||
out_sub = scratch_dir / f"img_{idx:06d}"
|
||||
|
||||
Reference in New Issue
Block a user