executable_smart-resize
360 bytes
1#!/usr/bin/env bash
2#
3# resize-test.sh
4# Copyright (C) 2018 pavle <pavle.portic@tilda.center>
5#
6# Distributed under terms of the MIT license.
7#
8
9echo "Resizing "$1
10
11RES=$(identify -format '%G\n' $1)
12
13XRES=$(echo $RES | cut -d "x" -f1)
14YRES=$(echo $RES | cut -d "x" -f2)
15
16if (( XRES > YRES )); then
17 convert $1 -resize $2x $1
18else
19 convert $1 -resize x$2 $1
20fi