pipine svg results in differing output from passing filename as arg

Started by richardmonette, October 14, 2022, 11:33:46 AM

Previous topic - Next topic

richardmonette

Running

main> exiftool test.svg

reports

File Type                       : SVG
File Type Extension             : svg
MIME Type                       : image/svg+xml

which is what I would expect, however running (as a pipe)

main> cat test.svg | exiftool -

reports

File Type                       : XMP
File Type Extension             : xmp
MIME Type                       : application/rdf+xml

which I believe is unexpected (and arguably incorrect), one would have expected the same result as when opening via filename.

Is there a way to have the piped version also report the expected SVG info?

Thank you!

Phil Harvey

If the file begins with "<svg" then it should be identified as SVG when read via a pipe.

How does your file start?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

richardmonette

Hi Phil,

Thank you for taking the time to look at my bug report!

Here is a more complete reproduction case:

main> cat circle.svg
<svg height="100" width="100">
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
  Sorry, your browser does not support inline SVG.
</svg>
main> cat circle.svg | exiftool -
ExifTool Version Number        : 12.30
File Size                      : 168 bytes
File Modification Date/Time    : 2022:10:14 14:22:42-04:00
File Access Date/Time          : 2022:10:14 14:22:42-04:00
File Inode Change Date/Time    : 2022:10:14 14:22:42-04:00
File Permissions                : prw-rw----
File Type                      : XMP
File Type Extension            : xmp
MIME Type                      : application/rdf+xml
Svg Height                      : 100
Svg Width                      : 100
Svg Circle Cx                  : 50
Svg Circle Cy                  : 50
Svg Circle R                    : 40
Svg Circle Stroke              : black
Svg Circle Stroke-width        : 3
Svg Circle Fill                : red
main> exiftool -ver
12.30
main>

I've also reproduced the same troublesome behaviour with

<svg width="215" height="61" viewBox="0 0 215 61" fill="none" xmlns="http://www.w3.org/2000/svg">
as my first line.

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

richardmonette

Looks like it's fixed as of 12.42  :)

main> cat circle.svg | exiftool -
ExifTool Version Number         : 12.42
File Size                       : 168 bytes
File Modification Date/Time     : 2022:10:14 14:55:00-04:00
File Access Date/Time           : 2022:10:14 14:55:00-04:00
File Inode Change Date/Time     : 2022:10:14 14:55:00-04:00
File Permissions                : prw-rw----
File Type                       : SVG
File Type Extension             : svg
MIME Type                       : image/svg+xml
Image Height                    : 100
Image Width                     : 100
Image Size                      : 100x100
Megapixels                      : 0.010
main>

Sorry about that and thank you for your help.