feat: graphicsmagick support

This commit is contained in:
ange 2024-04-14 13:53:40 +02:00
parent 1978f835b4
commit d75c797026
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
2 changed files with 15 additions and 3 deletions

View File

@ -18,14 +18,21 @@ function compress() {(
newdir="${PWD%/*}/$(basename "$dir")_1080p" newdir="${PWD%/*}/$(basename "$dir")_1080p"
mkdir -p "$newdir" mkdir -p "$newdir"
for file in *; do for file in *; do
identify "$file" 2> /dev/null >&2 \ "${IDENTIFY[@]}" "$file" 2> /dev/null >&2 \
&& convert -resize x1080 "$file" "$newdir/$file" & && "${CONVERT[@]}" -resize x1080 "$file" "$newdir/$file" &
wait_queue wait_queue
nb="$(printf '%s\n' "$newdir"/* | wc -l)" nb="$(printf '%s\n' "$newdir"/* | wc -l)"
echo "$((nb * 100 / total))" echo "$((nb * 100 / total))"
done done
)} )}
IDENTIFY=(identify)
CONVERT=(convert)
if command -v gm > /dev/null; then
IDENTIFY=(gm "${IDENTIFY[@]}")
CONVERT=(gm "${CONVERT[@]}")
fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
set "$(zenity --file-selection --multiple --directory --separator=' set "$(zenity --file-selection --multiple --directory --separator='
')" > /dev/null ')" > /dev/null

View File

@ -1,7 +1,12 @@
#!/bin/bash -e #!/bin/bash -e
CONVERT=(convert)
if command -v gm > /dev/null; then
CONVERT=(gm "${CONVERT[@]}")
fi
mkdir -p test test_1080p mkdir -p test test_1080p
gm convert -size 3840x2160 xc:black test/000.png "${CONVERT[@]}" -size 3840x2160 xc:black test/000.png
printf '%s\n' {001..127} | xargs -P0 -I'{}' cp test/000.png test/'{}'.png printf '%s\n' {001..127} | xargs -P0 -I'{}' cp test/000.png test/'{}'.png