|
|
|
@ -4,12 +4,12 @@ abs() {
|
|
|
|
|
[[ $[ $@ ] -lt 0 ]] && echo "$[ ($@) * -1 ]" || echo "$[ $@ ]"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DIMS=( $(identify "${1}" | cut -d\ -f3 | sed "s/x/ /g") )
|
|
|
|
|
PWRS=( 16 32 128 256 512 1024 )
|
|
|
|
|
DIMENSIONS=( $(identify "${1}" | cut -d\ -f3 | sed "s/x/ /g") )
|
|
|
|
|
POWERS=( 16 32 64 128 )
|
|
|
|
|
|
|
|
|
|
for PWR in ${PWRS[@]}; do
|
|
|
|
|
WIDEDIFS+=( $(abs "${DIMS[0]}-${PWR}") )
|
|
|
|
|
HITEDIFS+=( $(abs "${DIMS[1]}-${PWR}") )
|
|
|
|
|
for POWER in ${POWERS[@]}; do
|
|
|
|
|
WIDEDIFS+=( $(abs "${DIMENSIONS[0]}-${POWER}") )
|
|
|
|
|
HITEDIFS+=( $(abs "${DIMENSIONS[1]}-${POWER}") )
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
IFS=$'\n'
|
|
|
|
@ -17,7 +17,7 @@ WIDESORT=( $(sort -n <<<"${WIDEDIFS[*]}"))
|
|
|
|
|
HITESORT=( $(sort -n <<<"${HITEDIFS[*]}"))
|
|
|
|
|
unset IFS
|
|
|
|
|
|
|
|
|
|
for SIZE in $((DIMS[0] - WIDESORT[0])) $((DIMS[0] + WIDESORT[0])); do
|
|
|
|
|
for SIZE in $((DIMENSIONS[0] - WIDESORT[0])) $((DIMENSIONS[0] + WIDESORT[0])); do
|
|
|
|
|
(( SIZE > 0 && (SIZE & (SIZE - 1)) == 0 )) && RESIZE=${SIZE}
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|