identify -- XML dummy -- magic says SVG
-
- Posts: 34
- Joined: 2010-02-25T15:22:50-07:00
- Authentication code: 8675308
identify -- XML dummy -- magic says SVG
$ cat xml
<?xml version="1.0" encoding="UTF-8"?>
<test/>
$ identify -format "%m" xml
SVG
and that is just wrong, isn't it? Wouldn't you want to at least check for <svg>?
<?xml version="1.0" encoding="UTF-8"?>
<test/>
$ identify -format "%m" xml
SVG
and that is just wrong, isn't it? Wouldn't you want to at least check for <svg>?
Re: identify -- XML dummy -- magic says SVG
ImageMagick uses a light weight fast process for identifying an image generally by comparing the first few bytes of the image header. The image is then passed to the appropriate coder for further analysis. It is possible the identification process can get a false positive and that is considered ok since the image coder will subsequently return an exception if its not. However, if you ping an image, the deep analysis is not performed so a false-positive is possible and we find that acceptable.
-
- Posts: 34
- Joined: 2010-02-25T15:22:50-07:00
- Authentication code: 8675308
Re: identify -- XML dummy -- magic says SVG
Makes sense. Thanks.
With a slideshow DCP glue tool I'm writing (http://wiki.github.com/wolfgangw/digita ... nemaslides) I want to be able to say
in dirs that have decodable files and non-decodable files, skipping the latter.
So, apart from the SVG/XML dummy example is there a list of likely false positives that I'd want to catch?
With a slideshow DCP glue tool I'm writing (http://wiki.github.com/wolfgangw/digita ... nemaslides) I want to be able to say
Code: Select all
$ cinemaslides *
So, apart from the SVG/XML dummy example is there a list of likely false positives that I'd want to catch?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -- XML dummy -- magic says SVG
For each input file, you might say:
convert infile NULL:
and check for non-zero returns.
convert infile NULL:
and check for non-zero returns.
snibgo's IM pages: im.snibgo.com
-
- Posts: 34
- Joined: 2010-02-25T15:22:50-07:00
- Authentication code: 8675308
Re: identify -- XML dummy -- magic says SVG
Neat, but not quite, I think:
display likes the file (doesn't draw the polygon, though). So the file could be used but I'd skip it on the non-zero answer to a blank convert.
(Ubuntu's default IM 6.5.7-8 2009-11-26 Q16)
Code: Select all
$ cat resistor.svg | grep -v '<!--'
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:ev="http://www.w3.org/2001/xml-events"
version="1.1" baseProfile="full"
width="700px" height="400px" viewBox="0 0 700 400">
<line x1="0" y1="200" x2="700" y2="200" stroke="black" stroke-width="20px" />
<rect x="100" y="100" width="500" height="200" fill="white" stroke="black" stroke-width="20px" />
<line x1="180" y1="370" x2="500" y2="50" stroke="black" stroke-width="15px" />
<polygon points="585 0 525 25 585 50" transform="rotate(135 525 25)" />
</svg>
$ convert resistor.svg NULL:
convert: Non-conforming drawing primitive definition `�' @ draw.c/DrawImage/3140.
(Ubuntu's default IM 6.5.7-8 2009-11-26 Q16)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -- XML dummy -- magic says SVG
Have you got the rsvg delegate?
snibgo's IM pages: im.snibgo.com
-
- Posts: 34
- Joined: 2010-02-25T15:22:50-07:00
- Authentication code: 8675308
Re: identify -- XML dummy -- magic says SVG
Ubuntu's IM (6.5.7-8 2009-11-26 Q16) doesn't:
Thanks for the hints
Code: Select all
$ convert -list configure | grep DELEGATES
DELEGATES bzlib djvu freetype gvc jpeg jng jp2 lcms openexr png tiff x11 xml wmf zlib
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify -- XML dummy -- magic says SVG
rsvg is not in your list of delegate. so you need to install that and then reinstall IM. then check the delegates again. otherwise you are using IM's internal msvg, I believe, which may not be as good or full functioned as rsvg
-
- Posts: 34
- Joined: 2010-02-25T15:22:50-07:00
- Authentication code: 8675308
Re: identify -- XML dummy -- magic says SVG
Fred, I will test rsvg output. I can't steer off the target platform too far, though. cinemaslides already is an exotic little bugger. But I think now I have some sort of a handle on this.
Thanks for your advice and suggestions.
Thanks for your advice and suggestions.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: identify -- XML dummy -- magic says SVG
See Drawing SVG
http://www.imagemagick.org/Usage/draw/#svg
http://www.imagemagick.org/Usage/draw/#svg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -- XML dummy -- magic says SVG
The requested URL /Usage/raw was not found on this server.See Drawing SVG
http://www.imagemagick.org/Usage/raw/#svg
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify -- XML dummy -- magic says SVG
You mistyped. It is draw not raw.The requested URL /Usage/raw was not found on this server.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: identify -- XML dummy -- magic says SVG
I clicked on the link, which someone has now kindly corrected.
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: identify -- XML dummy -- magic says SVG
Wasn't me and only a few people can correct other peoples emails on the list (I'm one).
It may be that I made a cut and paste error, in which case.. applogies.
getting back to the original problem.
IM SVG handler only uses basic file 'magic' (see the man page on the 'file' command) for determining what type of image file it has, regardless of the suffix of the filename. It may be that this 'magic' for SVG is not quite good enough to separate ordinary XML form XML containing SVG.
XML has become a very common file format for storing configuration data and programs, and IM does make extensive use of it for its own configuarion. It probably should differentiate the XML more than it does.
However as Cristy (aka magick) said, it does not do a deeper test in a quick 'ping' check.
Hmmm the "file" command actually looks for the string "<svg" somewhere between 23 and 400 characters into the file (just the first read block) as well as the normal "<?xml" start tag. Tis was decoded form the "/usr/share/misc/magic" file on my linux system with the help of the "magic" manpage.
It may be that I made a cut and paste error, in which case.. applogies.
getting back to the original problem.
IM SVG handler only uses basic file 'magic' (see the man page on the 'file' command) for determining what type of image file it has, regardless of the suffix of the filename. It may be that this 'magic' for SVG is not quite good enough to separate ordinary XML form XML containing SVG.
XML has become a very common file format for storing configuration data and programs, and IM does make extensive use of it for its own configuarion. It probably should differentiate the XML more than it does.
However as Cristy (aka magick) said, it does not do a deeper test in a quick 'ping' check.
Hmmm the "file" command actually looks for the string "<svg" somewhere between 23 and 400 characters into the file (just the first read block) as well as the normal "<?xml" start tag. Tis was decoded form the "/usr/share/misc/magic" file on my linux system with the help of the "magic" manpage.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/