[+] Default out name - same as input, default overlap - 0

This commit is contained in:
VoidVolker 2015-07-28 20:56:52 +03:00
parent 922ddded24
commit d86f155f4e
1 changed files with 21 additions and 9 deletions

View File

@ -6,7 +6,8 @@ date="28/07/2015"
# resultExt='png' # resultExt='png'
resultExt='' resultExt=''
resizeFilter='' # http://www.imagemagick.org/Usage/filter/ resizeFilter='' # http://www.imagemagick.org/Usage/filter/
resultDir='./sliceResult' # resultDir='./sliceResult'
resultDir=''
# Selector fo slicer: A or B # Selector fo slicer: A or B
scaleFromImage=true # Type of scaling: if true - scale calculates from image size to down (slicer A), if false - image scale starts from tile size and grow up (slicer B) scaleFromImage=true # Type of scaling: if true - scale calculates from image size to down (slicer A), if false - image scale starts from tile size and grow up (slicer B)
gravity='NorthWest' # Image positioning (from this option depends, which tiles sides can be cropped, if it not full size). Choices include: 'NorthWest', 'North', 'NorthEast', 'West', 'Center', 'East', 'SouthWest', 'South', 'SouthEast'. Use -list gravity to get a complete list of -gravity settings available in your ImageMagick installation. gravity='NorthWest' # Image positioning (from this option depends, which tiles sides can be cropped, if it not full size). Choices include: 'NorthWest', 'North', 'NorthEast', 'West', 'Center', 'East', 'SouthWest', 'South', 'SouthEast'. Use -list gravity to get a complete list of -gravity settings available in your ImageMagick installation.
@ -98,7 +99,7 @@ oHelp(){
then then
echo " Output directory for result." echo " Output directory for result."
echo echo
echo " Default: ./sliceResult" echo " Default: same as source"
echo " Type: str" echo " Type: str"
echo echo
fi fi
@ -554,10 +555,19 @@ then
fi fi
# Set extension # Set extension
fullName=$(basename "$imageSource")
fileBase="${fullName%.*}"
fileExt="${fullName%.*}"
if $ExtNotDefined if $ExtNotDefined
then then
fname=$(basename "$imageSource") resultExt="$fileExt"
resultExt="${fname##*.}" fi
# Set out name
if $ResDirNotDefined
then
resultDir="$fileBase"
fi fi
# ——————————————————————————————————————————————————————————————————————————————————— # ———————————————————————————————————————————————————————————————————————————————————
@ -847,9 +857,10 @@ mainScale(){ # min zoom = tile width
setDziFormat(){ setDziFormat(){
local dziFileName="${resultDir}.dzi" local dziFileName="${resultDir}.dzi"
resultDir="${resultDir}_files"
tileH=$tileW tileH=$tileW
echo '<?xml version="1.0"?>' > "$dziFileName" echo '<?xml version="1.0"?>' > "$dziFileName"
echo "<Image TileSize=\"${tileW}\" Overlap=\"2\" Format=\"${resultExt}\" xmlns=\"http://schemas.microsoft.com/deepzoom/2008\">" >> "$dziFileName" echo "<Image TileSize=\"${tileW}\" Overlap=\"0\" Format=\"${resultExt}\" xmlns=\"http://schemas.microsoft.com/deepzoom/2008\">" >> "$dziFileName"
echo "<Size Width=\"${imageW}\" Height=\"${imageH}\"/>" >> "$dziFileName" echo "<Size Width=\"${imageW}\" Height=\"${imageH}\"/>" >> "$dziFileName"
echo '</Image>' >> "$dziFileName" echo '</Image>' >> "$dziFileName"
# <?xml version="1.0"?> # <?xml version="1.0"?>
@ -871,18 +882,19 @@ init(){
echo "You get infinity loop. Minimum step value = 101% (101)" echo "You get infinity loop. Minimum step value = 101% (101)"
exit 1 exit 1
fi fi
rm -rf $resultDir # removing old results
mkdir -p $resultDir # creating new results folder
# Getting image sizes # Getting image sizes
imageW=`getImgW $imageSource` imageW=`getImgW $imageSource`
imageH=`getImgH $imageSource` imageH=`getImgH $imageSource`
# Set options for selected format # Set options for selected format
setFormat setFormat
# Set scale # Set scale
setScale setScale
rm -rf $resultDir # removing old results
mkdir -p $resultDir # creating new results folder
} }
# ——————————————————————————————————————————————————————————————————————————————————— # ———————————————————————————————————————————————————————————————————————————————————