Using variables with convert circle?
Using variables with convert circle?
I can draw a circle fine using:-
-fill blue -draw 'circle 20,200 32,212'
but if I try to use variables below in a bash shell script its fails with "non-conforming drawing primitive definition `circle' ".
-fill blue -draw 'circle "$ax",200 $ay,212'
It looks like its a combination of using the right '"` around the variable. Can anyone suggest the correct combination?
Thanks in advance...
Simmo.
-fill blue -draw 'circle 20,200 32,212'
but if I try to use variables below in a bash shell script its fails with "non-conforming drawing primitive definition `circle' ".
-fill blue -draw 'circle "$ax",200 $ay,212'
It looks like its a combination of using the right '"` around the variable. Can anyone suggest the correct combination?
Thanks in advance...
Simmo.
Re: Using variables with convert circle?
TYPO in code, that should have been...
I can draw a circle fine using:-
-fill blue -draw 'circle 20,200 32,212'
but if I try to use variables below in a bash shell script its fails with "non-conforming drawing primitive definition `circle' ".
-fill blue -draw 'circle "$ax",200 "$ay",212'
It looks like its a combination of using the right '"` around the variable. Can anyone suggest the correct combination?
Thanks in advance...
Simmo.
I can draw a circle fine using:-
-fill blue -draw 'circle 20,200 32,212'
but if I try to use variables below in a bash shell script its fails with "non-conforming drawing primitive definition `circle' ".
-fill blue -draw 'circle "$ax",200 "$ay",212'
It looks like its a combination of using the right '"` around the variable. Can anyone suggest the correct combination?
Thanks in advance...
Simmo.
Re: Using variables with convert circle?
Why is it you always work out the answer shortly after posting after having spent hours on the problem?
The answer is...
-fill blue -draw "circle $ax,200 $ay,212"
I just needed to replace the single quote e.g ' with double quotes around the whole circle command.
Hope this helps someone else...
Simmo
The answer is...
-fill blue -draw "circle $ax,200 $ay,212"
I just needed to replace the single quote e.g ' with double quotes around the whole circle command.
Hope this helps someone else...
Simmo
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Using variables with convert circle?
because in writing out the problem for someone else you get a different point of view which suddenly makes you see the cause of the problem!!!simmo512 wrote:Why is it you always work out the answer shortly after posting after having spent hours on the problem?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Using variables with convert circle?
Hello together,
I can't figure out which values I have to use for x0,y0 x1,y1 to draw a circle of a defined size.
I often get circles that are somehow cut off.
E.g I want to draw a circle with a radius of 8 and the center at 23,30. I tried:The same with "-draw 'circle 23,30 31,30'"
I have read http://www.imagemagick.org/script/comma ... s.php#draw but that doesn't provide very much information. I'd be glad if someone could explain or provide a link to an explanation.
Thanks in advance and best regards
maceis
I can't figure out which values I have to use for x0,y0 x1,y1 to draw a circle of a defined size.
I often get circles that are somehow cut off.
E.g I want to draw a circle with a radius of 8 and the center at 23,30. I tried:
Code: Select all
convert -size 120x60 xc:none \
-fill '#aaa' \
-draw 'circle 23,30 23,38' \
x:
I have read http://www.imagemagick.org/script/comma ... s.php#draw but that doesn't provide very much information. I'd be glad if someone could explain or provide a link to an explanation.
Thanks in advance and best regards
maceis
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Using variables with convert circle?
The method you were using to create a circle is correct. If the circle is getting cut off then something else is wrong.
Can you give an example command and the resulting image? And which version of ImageMagick are you using?
Pete
Can you give an example command and the resulting image? And which version of ImageMagick are you using?
Pete
Re: Using variables with convert circle?
My Version is: ImageMagick 6.3.7
When saving the result of the above command as png-file I saw, that the resulting circle is not cut off.
Only in x: it looks like an octagon.
Anyhow. I am not sure what the x0,y0 x1,y1 values really are.
I think x0,y0 are the coordinates of rhe center of the circle.
Can x1,y1 be any point on the diameter of the circle?
When saving the result of the above command as png-file I saw, that the resulting circle is not cut off.
Only in x: it looks like an octagon.
Anyhow. I am not sure what the x0,y0 x1,y1 values really are.
I think x0,y0 are the coordinates of rhe center of the circle.
Can x1,y1 be any point on the diameter of the circle?
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Using variables with convert circle?
It's a point on the circumference (I presume that's what you meant).Can x1,y1 be any point on the diameter of the circle?
Pete
Re: Using variables with convert circle?
When I tried your code I also created a Octogen. It only happens if I save to jpg; if I save to png its OK.
This must be due to jpg not supporting transparency.
This must be due to jpg not supporting transparency.
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Using variables with convert circle?
I tried that with the command line. This produces an octagon:
But changing only the colour of the input image produces a circle:
It's very strange that the transparency has such an effect.
Pete
Code: Select all
convert -size 120x60 xc:none -fill #aaa -draw "circle 23,30 23,38" circle.jpg
Code: Select all
convert -size 120x60 xc:black -fill #aaa -draw "circle 23,30 23,38" circle.jpg
Pete
Re: Using variables with convert circle?
Yes. And it is also strange that X-Windows can handle transparency when you open files with transparency (e.g png files) but not when you specify x: as filename.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Using variables with convert circle?
There are other ways of drawing circles and even ellipses. some are center basied, other arc based, or even path basied. See IM Examples, Drawing for all the primatives and SVG path methods.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/