revisit crop image script

feat(images): improve JPG crop script reliability and safety

- Add detailed script header, description, and usage instructions
- Process only JPG/JPEG files
- Handle filenames containing spaces safely
- Verify ImageMagick dependencies before execution
- Use identify -format for reliable dimension detection
- Match images with width exactly 3546px
- Skip previously processed *_c.jpg and *_u.jpg files
- Add error handling for invalid or corrupt images
- Enable strict Bash mode (set -euo pipefail)
- Improve logging and processing feedback

move file

crop images
This commit is contained in:
Lucas Vivohost committed 2026-09-14 12:43:38 +02:00
1 parent f84d8d137b
commit c1ebc80235
2 files changed
+81 -12

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
for img in *; do
size=$(identify ${img} | cut -f3 -d' ')
if [[ "$(echo ${size} | grep 3546)" != "" ]]; then
echo $size
convert $img -crop 2448x3264+0+0 $(echo $img | sed 's/\.jpg/_c\.jpg/g')
mv $img $(echo $img | sed 's/\.jpg/_u\.jpg/g')
fi
done