17 lines
556 B
Bash
17 lines
556 B
Bash
resize_var="x1080"
|
|||
|
|
if [ "$1" != "" ]; then resize_var="$1"; fi
|
||
|
|
for file in *jpg ; do
|
||
|
|
if [ "$1" == "" ]; then
|
||
|
|
height="$(identify -quiet ${file} | cut -f3 -d' ' | cut -f2 -d'x')"
|
||
|
|
width="$(identify -quiet ${file} | cut -f3 -d' ' | cut -f1 -d'x')"
|
||
|
|
if [ "${height}" != "" ] && [ "${width}" != "" ]; then
|
||
|
|
if [ ${height} -gt ${width} ]; then
|
||
|
|
resize_var="x1080"
|
||
|
|
else
|
||
|
|
resize_var="1920"
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
echo "Transform $file to ${resize_var}"
|
||
|
|
convert -quiet "$file" -resize ${resize_var} $(echo "NEW/${file}" | sed 's/jp[e]\?g/png/g')
|
||
|
|
done
|