feat: graphicsmagick support
This commit is contained in:
parent
1978f835b4
commit
d75c797026
11
compress
11
compress
@ -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
|
||||||
|
7
test.sh
7
test.sh
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user