#!/bin/bash
#
# So viewed images don't get "lost"...
#
# Uses imagemagick's "identify" as a quick and lightweight 
# means to check width... if below a certain size the script 
# instructs the viewer (feh) to open with minimum dimensions of 400x400
# (at a screen offset of 100/100)
#
# otherwise open with feh - downscaling if larger than screen.
#

w=`gm identify -ping -format '%w' "$1"`
if [[ $w -lt 400 ]]; then
feh -g 400x400+100+100 "$1"
else
	feh --scale-down "$1"
fi
