commit d25430c86b37db09c3f09dc60ed1341a1fdcbdbf parent e4ac7daee8d5c15089bcc97c3e5e446a746821cc Author: Alex Balgavy <a.balgavy@gmail.com> Date: Sun, 2 Feb 2020 00:45:42 +0100 img-to-background: resize an iamge to fit into the background Former-commit-id: 28f4267f17033e12d5511fff70d0069539a1dd2d Diffstat:
A | scripts/img-to-background | | | 15 | +++++++++++++++ |
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/scripts/img-to-background b/scripts/img-to-background @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +aspect_ratio="16:10" +if ! command -v convert &>/dev/null; then + echo "convert not installed." >&2 + exit 1 +fi +die() { + echo "$1" >&2 + exit 1 +} + +[ $# -eq 1 ] || die "Filename argument needed." +[ -e "$1" ] || die "$1 does not exist." +[ -f "$1" ] || die "$1 is not a file." +convert "$1" -resize "$aspect_ratio" "${1/#/siz-}"