[SOLVED]convert parameters as a file
Posted: 2016-06-06T04:48:45-07:00
Hi everyone.
I use linux sh langage.
Short Version : I want to write the parameters of the convert function in a file (or a variable), and load it when calling the convert fonction in a sh script.
Long Version :
In need (or more exactly, i want) to generate an image which is basically a series of verticals bar (think of something like a barcode).
Because reason, i want to use a loop (each bar is the same, and the number of bar depends of the size of the image that can vary).
The loop look like this.
and the full command is like this :
if I do a and copy paste the result in command line (writing convert before, of course), if works fine.
exemple of echo "$Message"
But if I do in my script , i got an error (apparently, syntax error).
I tried different ways of doing it, but it fails (for one reason or another).
Is it possible to use convert this way ?
If yes, what is the correct syntax ?
I use linux sh langage.
Short Version : I want to write the parameters of the convert function in a file (or a variable), and load it when calling the convert fonction in a sh script.
Long Version :
In need (or more exactly, i want) to generate an image which is basically a series of verticals bar (think of something like a barcode).
Because reason, i want to use a loop (each bar is the same, and the number of bar depends of the size of the image that can vary).
The loop look like this.
Code: Select all
VerticalDraw(){
HeadPosition=100
while [ $HeadPosition -lt $(expr $MapVSize - 100 ) ];do
Message="$Message -draw \"rectangle 50,$(echo $HeadPosition) $(expr $MapHSize - 50 ),$(expr $HeadPosition + 50 )\""
HeadPosition=$(expr $HeadPosition + 100 )
done
}
Code: Select all
DrawMessage(){
Message="-size $(echo $MapHSize)x$MapVSize xc:white"
Message="$Message -fill black"
VerticalDraw
Message="$Message $GifFileName"
}
Code: Select all
echo "$Message"
exemple of echo "$Message"
Code: Select all
-size 1400x600 xc:white -fill black -draw "rectangle 50,100 1350,150" -draw "rectangle 50,200 1350,250" -draw "rectangle 50,300 1350,350" -draw "rectangle 50,400 1350,450" map.gif
Code: Select all
convert "$Message"
I tried different ways of doing it, but it fails (for one reason or another).
Is it possible to use convert this way ?
If yes, what is the correct syntax ?