#!/bin/bash

_MAGICK=/usr/bin/magick
WDIR=/mnt/HDD/share/public/typstHiking/image

BASENAME=$1
INPUT1="${WDIR}/${BASENAME}_1.jpg"
INPUT2="${WDIR}/${BASENAME}_2.jpg"
OUTPUT1="${WDIR}/${BASENAME}1.jpg"
OUTPUT2="${WDIR}/${BASENAME}2.jpg"

WIDTH=1440
HEIGHT=1150
ORIGINX=0
ORIGINY1=1785
ORIGINY2=334

${_MAGICK} ${INPUT1} -crop "${WIDTH}x${HEIGHT}+${ORIGINX}+${ORIGINY1}" ${OUTPUT1}
${_MAGICK} ${INPUT2} -crop "${WIDTH}x${HEIGHT}+${ORIGINX}+${ORIGINY2}" ${OUTPUT2}

mv ${OUTPUT1} ${INPUT1}
mv ${OUTPUT2} ${INPUT2}