Is it possible to get the Exif tag type with Exiftool?

Started by k.satou, June 29, 2022, 08:02:33 AM

Previous topic - Next topic

k.satou

I am currently trying to get Exif tag information for my images with Exiftool.
The information I want to get is the type of tag, e.g. Short, Rational, etc.
Is it possible to get this information with Exiftool?

I know that I can get the tag name and value as follows

Quoteksatou@50077PC:/mnt/f/test$ exiftool -s -exif:* images/JPEG/photoshop.jpg
ImageDescription                : Description
Orientation                     : Horizontal (normal)
XResolution                     : 72
YResolution                     : 72
ResolutionUnit                  : inches
Software                        : Adobe Photoshop CS5 Windows
ModifyDate                      : 2021:03:19 16:19:32
Artist                          : Artist
Copyright                       : Copyright
ColorSpace                      : sRGB
ExifImageWidth                  : 200
ExifImageHeight                 : 200
Compression                     : JPEG (old-style)
ThumbnailOffset                 : 382
ThumbnailLength                 : 5103
ThumbnailImage                  : (Binary data 5103 bytes, use -b option to extract)

I also know that Exiv2(https://exiv2.org/) can retrieve the type.

Quoteksatou@50077PC:/mnt/f/test $ exiv2 -pt images/JPEG/photoshop.jpg
Exif.Image.ImageDescription                  Ascii       7  Description
Exif.Image.Orientation                       Short       1  top, left
Exif.Image.XResolution                       Rational    1  72
Exif.Image.YResolution                       Rational    1  72
Exif.Image.ResolutionUnit                    Short       1  inch
Exif.Image.Software                          Ascii      28  Adobe Photoshop CS5 Windows
Exif.Image.DateTime                          Ascii      20  2021:03:19 16:19:32
Exif.Image.Artist                            Ascii      10  Artist
Exif.Image.Copyright                         Ascii      16  Copyright
Exif.Image.ExifTag                           Long        1  232
Exif.Photo.ColorSpace                        Short       1  sRGB
Exif.Photo.PixelXDimension                   Long        1  200
Exif.Photo.PixelYDimension                   Long        1  200
Exif.Thumbnail.Compression                   Short       1  JPEG (old-style)
Exif.Thumbnail.XResolution                   Rational    1  72
Exif.Thumbnail.YResolution                   Rational    1  72
Exif.Thumbnail.ResolutionUnit                Short       1  inch
Exif.Thumbnail.JPEGInterchangeFormat         Long        1  370
Exif.Thumbnail.JPEGInterchangeFormatLength   Long        1  5103

Thanks.

greybeard

Maybe there is a better way but :

exiftool -v2 images/JPEG/photoshop.jpg

will give you the tag types (and a lot more)

k.satou

Thanks, greybeard :)
I was able to get the tag type with the command you gave me.
But is it possible to get the tag and type information in a simpler output like Exiv2?(I use Exiftool because Exiv2 has unsupported extensions)
I would like to get the tag name, value and type obtained by Exiftool and finally processed by a linux command. As follows.

Quote
ksatou@50077PC:/mnt/f/test$ exiftool -s -exif:* images/JPEG/photoshop.jpg | cut --delimiter ":" -f 1
ImageDescription               
Orientation                     
XResolution                     
YResolution                     
ResolutionUnit                 
Software                       
ModifyDate                     
Artist                         
Copyright                       
ColorSpace                     
ExifImageWidth                 
ExifImageHeight                 
Compression                     
ThumbnailOffset                 
ThumbnailLength                 
ThumbnailImage

I think that the results output with the v2 option is a bit difficult to process with the linux command.
Thanks.

StarGeek

Quote from: k.satou on June 29, 2022, 08:02:33 AM
The information I want to get is the type of tag, e.g. Short, Rational, etc.
Is it possible to get this information with Exiftool?

Not when listing the output from a file without using the -v (-verbose) option as greybeard posted.

The information is available from the -listX option. The output is in XML and by default the list is quite large, especially since it will list all language descriptions.   This can be narrowed down by specifying a group and the -lang option.  Add the -s (-short) option also makes it a bit more human readable.

For example:
C:\>exiftool -listx -XMP-DC:all -lang en -s
<?xml version='1.0' encoding='UTF-8'?>
<!-- Generated by Image::ExifTool 12.42 -->
<taginfo>

<table name='XMP::dc' g0='XMP' g1='XMP-dc' g2='Other'>
<tag id='contributor' name='Contributor' type='string' writable='true' g2='Author'/>
<tag id='coverage' name='Coverage' type='string' writable='true'/>
<tag id='creator' name='Creator' type='string' writable='true' g2='Author'/>
<tag id='date' name='Date' type='date' writable='true' g2='Time'/>
<tag id='description' name='Description' type='lang-alt' writable='true' g2='Image'/>
<tag id='format' name='Format' type='string' writable='true' g2='Image'/>
<tag id='identifier' name='Identifier' type='string' writable='true' g2='Image'/>
<tag id='language' name='Language' type='string' writable='true'/>
<tag id='publisher' name='Publisher' type='string' writable='true' g2='Author'/>
<tag id='relation' name='Relation' type='string' writable='true'/>
<tag id='rights' name='Rights' type='lang-alt' writable='true' g2='Author'/>
<tag id='source' name='Source' type='string' writable='true' g2='Author'/>
<tag id='subject' name='Subject' type='string' writable='true' g2='Image'/>
<tag id='title' name='Title' type='lang-alt' writable='true' g2='Image'/>
<tag id='type' name='Type' type='string' writable='true' g2='Image'/>
</table>

</taginfo>
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

k.satou

Thanks StarGeek!
Using the -listx option seems to do what I wanted to do.

I appreciate all your help, thank you.