+ added helper scripts

+ moved uis into own files
+ log is not rerendered in full anymore
This commit is contained in:
Timo Niemann
2026-07-01 15:11:25 +02:00
parent 28d0fcc7dc
commit b7d7665fde
11 changed files with 588 additions and 408 deletions
+48
View File
@@ -0,0 +1,48 @@
# Helper
## Introduction
This subdirectory delivers simple helper programs.
## progressive_to_normal_jpegs.sh
Converts progressive jpegs into non progressive ones.
### Requirements:
Ensure jpegtran is installed.
- Linux
- Arch:
>sudo pacman -S libjpeg-turbo
- Debian:
>sudo apt install libjpeg-turbo-progs
- macOS:
>brew install jpeg
### Usage:
./progressive_to_normal_jpegs.sh /path/to/images
## resize.py
Handy tool to resize images to displays size (480x800).
### Disclaimer:
This tool takes 1 command line argument, the directory where the files-to-be-converted are stored.
### Requirements:
Virtual Environment (optional)
- create a venv:
>python -m venv .env
- activate venv
- Linux/macOS:
>source .env/bin/activate
- Windows
>./.env/Scripts/activate.bat
Python-Pillow
>pip install pillow
### Usage:
>python resize.py /path/to/images
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
DIR="$1"
if [ -z "$DIR" ]; then
echo "Usage: $0 /path/to/images"
exit 1
fi
if [ ! -d "$DIR" ]; then
echo "Error: Directory does not exist: $DIR"
exit 1
fi
for i in "$DIR"/*.jpeg "$DIR"/*.jpg; do
[ -e "$i" ] || continue
jpegtran -copy none -optimize -outfile "${i%.*}_out.${i##*.}" "$i"
done
+20
View File
@@ -0,0 +1,20 @@
from PIL import Image
import os
import sys
TARGET = (480, 800)
INPUT_DIR = sys.argv[1] if len(sys.argv) > 1 else "."
EXTENSIONS = {".jpg", ".jpeg", ".png", ".webp", ".bmp"}
for filename in os.listdir(INPUT_DIR):
ext = os.path.splitext(filename)[1].lower()
if ext not in EXTENSIONS:
continue
path = os.path.join(INPUT_DIR, filename)
img = Image.open(path)
img.thumbnail(TARGET, Image.LANCZOS)
img.save(path)
print(f"{filename}: {img.size}")