dotfiles/dot_local/bin/executable_smart-resize

21 lines
360 B
Bash

#!/usr/bin/env bash
#
# resize-test.sh
# Copyright (C) 2018 pavle <pavle.portic@tilda.center>
#
# Distributed under terms of the MIT license.
#
echo "Resizing "$1
RES=$(identify -format '%G\n' $1)
XRES=$(echo $RES | cut -d "x" -f1)
YRES=$(echo $RES | cut -d "x" -f2)
if (( XRES > YRES )); then
convert $1 -resize $2x $1
else
convert $1 -resize x$2 $1
fi