diff --git a/stpkg b/stpkg index 7d0a1f6cd9bd45f5ad14bf41684d771100931f0e..bdbf62e63ef7e4e9e52ec7849f7aaef098d9c883 100755 --- a/stpkg +++ b/stpkg @@ -195,13 +195,15 @@ picture_process_sticker() { local HEIGHT=$5 # The HEIGHT! local TYPE=$6 # The type of the file (png/gif) + local repage=`[ "x${TYPE}" != "xgif" ] && echo '+repage' || echo ''` + local resize=`[ "x${TYPE}" != "xgif" ] && echo "-resize ${WIDTH}x${HEIGHT}" || echo ''` local OPTS=`[ "$TYPE" = "png" ] && echo '-type TrueColor PNG32:' || echo ' -coalesce '` info "File '$FILE' => '$DEST' ($TYPE) | OPTS = '$OPTS'" convert "$FILE" -bordercolor none -border 1 "$DEST" 1>&2 && progress_dot || die "$NAME failed on border" - convert "$DEST" +repage "$DEST" 1>&2 && progress_dot || die "$NAME failed on trim" - convert -background none -gravity center "$DEST" -resize "${WIDTH}x${HEIGHT}" $OPTS"$DEST" 1>&2 \ + convert "$DEST" -trim ${repage} "$DEST" 1>&2 && progress_dot || die "$NAME failed on trim" + convert -background none -gravity center "$DEST" ${resize} $OPTS"$DEST" 1>&2 \ && progress_dot \ || die "$NAME failed on ${WIDTH}x${HEIGHT} resize" }