Hi ,
Would it be easy to create this type of compass with imagemagick ?
https://commons.wikimedia.org/wiki/File ... 0_(en).svg
I don't find any topic on the way to create it; can someone guide me to make it ?
Best regards,
360° compass image
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 360° compass image
Very easy:
Code: Select all
magick "Compass_360_(en).svg" out.png
snibgo's IM pages: im.snibgo.com
Re: 360° compass image
Thanks for reply but -well- sure I haven't been clear;
I want to display compass informations on top or bottom of rectilinear photos ( and/or spherical ones) depending on their horizontal field of view and azimuth , calculated and taken from exif datas; which is the hardest? making it polar ( I then reproject it with hugin ) or as a ruler ? Making it on the fly would also permit me to change the style.
I'm used to make it with inkscape - very easily ; do you confirm that's the only way?
I want to display compass informations on top or bottom of rectilinear photos ( and/or spherical ones) depending on their horizontal field of view and azimuth , calculated and taken from exif datas; which is the hardest? making it polar ( I then reproject it with hugin ) or as a ruler ? Making it on the fly would also permit me to change the style.
I'm used to make it with inkscape - very easily ; do you confirm that's the only way?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: 360° compass image
Perhaps you should provide an example of what you are trying to do with your input images and your output image. Or at least an example of what you would like for the output.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 360° compass image
I often do jobs like this by writing a simple program that generates SVG. But this can be done entirely in IM, like this:
(Windows BAT syntax. For bash, use \ for line ends and don't double the %%.)
I've done only the major gridlines, and the numbers go the wrong way round, but hopefully you can see the idea.
I start with an empty canvas (which isn't strictly necessary). Then I make 36 images with a small rectangle, which is the marker at the north point, but rotate each (with "-distort SRT") according to its number multipled by ten degrees. Similarly for the text numbers. Finally, I merge all the images.
Code: Select all
%IMG7%magick ^
-size 500x500 xc:White ^
-fill Black ^
( xc:None ^
-draw "rectangle 249,20 251,70" ^
-duplicate 35 ^
-distort SRT 1,%%[fx:t*10] ^
) ^
( xc:None ^
-gravity North ^
-pointsize 15 ^
-duplicate 35 ^
-annotate 0 %%[fx:t*10] ^
-distort SRT 1,%%[fx:t*10] ^
) ^
-compose Over -layers Merge ^
simp_compass.png
I've done only the major gridlines, and the numbers go the wrong way round, but hopefully you can see the idea.
I start with an empty canvas (which isn't strictly necessary). Then I make 36 images with a small rectangle, which is the marker at the north point, but rotate each (with "-distort SRT") according to its number multipled by ten degrees. Similarly for the text numbers. Finally, I merge all the images.
snibgo's IM pages: im.snibgo.com
Re: 360° compass image
@snibgo many thanks -and that's the good way for numbers;
But your code, copied with bash syntax as your recommendations, give me that :
This time I use ImageMagick 6.9.7-4 Q16 x86_64 20170114 on Ubuntu studio 18.04, Linux 4.15.0-29-lowlatency
I've tested many variations, without success to remove the black lines. This is the code in my terminal, without end of lines (are they really important?);
But your code, copied with bash syntax as your recommendations, give me that :
This time I use ImageMagick 6.9.7-4 Q16 x86_64 20170114 on Ubuntu studio 18.04, Linux 4.15.0-29-lowlatency
I've tested many variations, without success to remove the black lines. This is the code in my terminal, without end of lines (are they really important?);
Code: Select all
convert -size 500x500 xc:White -fill Black \( xc:None -draw "rectangle 249,20 251,70" -duplicate 35 -distort SRT 1,%[fx:t*10] \) \( xc:None -gravity North -pointsize 12 -duplicate 35 -annotate 0 %[fx:t*10] -distort SRT 1,%[fx:t*10] \) -compose Over -layers Merge test-compas.png
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 360° compass image
After "-fill Black", insert "-virtual-pixel None".
EDIT: No, chopping a command into lines is not important to IM. I do it to make the command easier for humans to read and understand.
EDIT: No, chopping a command into lines is not important to IM. I do it to make the command easier for humans to read and understand.
snibgo's IM pages: im.snibgo.com