-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslice.sh
executable file
·28 lines (25 loc) · 1.13 KB
/
slice.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# slice.sh - takes a vertical slice of specified pixel width from the middle of each
# tiff or jpeg file in current directory. Creates slice_$1/*
#
# Copyright (C) 2011 Roger Barnes http://roger.mindsocket.com.au
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License,
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
sliceparam=${1}x99999
if [ "x$2" == "xhoriz" ]; then
sliceparam=99999x${1}
fi
mkdir -p slice_$1
FINDCMD='find . -maxdepth 1 -name "*.tif" -or -name "*.jpg"'
eval $FINDCMD | xargs --verbose -n 1 -P 8 -Ixxx convert xxx -gravity Center -crop ${sliceparam}+0+0 slice_$1/xxx.tif