Scale down picture, fill rest with border.
Posted: 2013-10-22T22:09:40-07:00
I suppose this wil be more a mathematic problem than anythingelse..
I have this CommandRegarding to how much I shrink the original image - the border parameters will be different.
I am have to placed it into a script so I can use variables for the -resize value and the -border value.
Here is my script, which is not working corectly. It gives different output sizes depending to the percentage I have as input parameter
~
~
~
~
I have this Command
Code: Select all
convert Forvaltningsratten.png -resize 20% -bordercolor Black -border 200%x200% 20-perc_Förvaltningsratten.png
I am have to placed it into a script so I can use variables for the -resize value and the -border value.
Here is my script, which is not working corectly. It gives different output sizes depending to the percentage I have as input parameter
Code: Select all
#!/bin/bash
ImageSize=$1 #eg 1280*720
Percent=$2 # eg 30
Color=$3
BorderSize=$(bc -l <<< "($ImageSize/($ImageSize*$Percent/100)/2+10)*10")
convert Forvaltningsratten.png -resize $Percent% -bordercolor $Color -border \ $BorderSize%x$BorderSize% $Percent-perc_Forvaltningsratten.png
~
~
~