Reading MVG files

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
taxisaga
Posts: 14
Joined: 2018-07-10T11:13:28-07:00
Authentication code: 1152
Location: Sunnyvale, CA

Reading MVG files

Post by taxisaga »

Version: ImageMagick 7.0.8-8 Q16 x86_64 2018-07-23 https://www.imagemagick.org
--

I'm trying to reproduce the third example in this section under Reading MVG Files:

https://www.imagemagick.org/Usage/draw/#reading


The example shows this .mvg file contents:

Code: Select all

viewbox 0 0 100 60
fill khaki   rectangle 0,0 100 60
fill green   circle 41,39 44,57
fill blue    circle 59,39 56,57
fill red     circle 50,21 50,3
And this command line:

Code: Select all

 convert    mvg_circles2.mvg    mvg_image.gif
When I save a file with those contents and run that command, what I get is:

Code: Select all

$ convert mvg_circles2.mvg mvg_image.gif
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/512.
convert: no images defined `mvg_image.gif' @ error/convert.c/ConvertImageCommand/3275.
Any ideas how to get this to work?

This is in a bash shell in macOS. I've tried prepending '@' in front of the .mvg file name, or not, and with and without various means of quoting and/or escaping. No go. I also tried changing .gif to .jpg in my command, because that is what I need ultimately.

The problem is above. Below, no problems.

This does work:

script file:

Code: Select all

#!/bin/bash

convert -size 96x96 xc:white \
    -fill none -stroke black -strokewidth 1 \
    -draw @draw.mvg \
    test.jpg
...used with this different .mvg file, tweaked from the other examples on that web page:

Code: Select all

fill none rectangle 3,0 5 2
fill none line 9,0 11,2
fill none line 15,2 17,0
fill none line 21,1 23,1
fill none line 28,0 28,2
fill none polygon 33,0 33,2 35,2
fill none line 0,10 95,10
fill none line 0,12 95,12
fill none line 0,14 95,14
fill none line 0,16 95,16
fill none line 0,18 95,18
fill none line 0,20 95,20
fill none line 0,22 95,22
fill none line 0,24 95,24
fill none line 0,26 95,26
fill none rectangle 80,82 82 84
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Reading MVG files

Post by fmw42 »

try the following:

Code: Select all

convert    MSVG:mvg_circles2.mvg    mvg_image.gif
taxisaga
Posts: 14
Joined: 2018-07-10T11:13:28-07:00
Authentication code: 1152
Location: Sunnyvale, CA

Re: Reading MVG files

Post by taxisaga »

Thanks for the reply. No luck with that:

Code: Select all

$ convert    MSVG:mvg_circles2.mvg    mvg_image.gif
convert: Document is empty
 `No such file or directory` @ error/svg.c/SVGError/2919.
convert: no images defined `mvg_image.gif' @ error/convert.c/ConvertImageCommand/3275.

Code: Select all

$ ls -l mvg*
-rw-r--r--  1 sagaraga  staff  148 Aug 15 13:36 mvg_circles2.mvg
$ cat mvg_circles2.mvg 
viewbox 0 0 100 60
fill khaki   rectangle 0,0 100 60
fill green   circle 41,39 44,57
fill blue    circle 59,39 56,57
fill red     circle 50,21 50,3
The file mvg_image.gif does not exist on my filesystem. I am expecting that it is to be created by the command... maybe this expectation is wrong?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Reading MVG files

Post by fmw42 »

My typo. This works for me:

Code: Select all

convert MVG:test.mvg test.gif
taxisaga
Posts: 14
Joined: 2018-07-10T11:13:28-07:00
Authentication code: 1152
Location: Sunnyvale, CA

Re: Reading MVG files

Post by taxisaga »

Ah yes it works! Thanks!
Post Reply