Question

How to extract metadata from JPEG

  • 16 October 2016
  • 7 replies
  • 91 views

Hi - First post to ask a question.......I have tried to use attribute exposer to extract metadata from a jpg image, however, it does not appear to extract all the metadata that I am aware exists for the file. Example is shown of some of the metadata that exists for the file, namely relative altitude and pitch, roll and yaw. Can someone advise as to how I might extract these data (and others not shown via attribute exposer)?

Thanks


7 replies

Badge +16

Hi @knotboy, do you mean that beside the standard format attributes that can be exposed in the reader ?(https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/jpeg/Feature_Representation.htm

there are more metadata attributes?

Hi itay - Yes, I have looked at the user and format attributes in the reader and they don't appear as options (as I see). I looked at the link you provided and that is the list that comes up as options in the format attributes.

 

 

Badge +16

Hi if these attributes are not available as format or user attributes, then I would suggest trying to use a third party tool (via the system caller) to possibly make these specific attributes available in your workspace.

Userlevel 6
Badge +32

Hi if these attributes are not available as format or user attributes, then I would suggest trying to use a third party tool (via the system caller) to possibly make these specific attributes available in your workspace.

Learned something new today!

 

Directory and File Pathnames and SystemCaller with IrfanView results in nice data:

 

"D:\apps\IrfanView\i_view32.exe @Value(path_windows) /info=@Value(path_directory_windows)\@Value(path_rootname).txt /fullinfo"
Badge +16
Learned something new today!

 

Directory and File Pathnames and SystemCaller with IrfanView results in nice data:

 

"D:\apps\IrfanView\i_view32.exe @Value(path_windows) /info=@Value(path_directory_windows)\@Value(path_rootname).txt /fullinfo"
Yes Ifranview is a good tool that can be easily accessed via FME, I think that for JPEG metadata (exif) the following tool is probably better http://www.sno.phy.queensu.ca/~phil/exiftool/

 

 

Userlevel 4

You can also use the PythonCaller with the exifread module (must be installed manually):

import exifread
import fmeobjects

class FeatureProcessor(object):
    def input(self,feature):
        filename = feature.getAttribute('image_filename')
        if filename:
            with open(filename, 'rb') as f:
                tags = exifread.process_file(f, details=False)
                for tag in tags.keys():
                    feature.setAttribute(tag, str(tags[tag]))
        self.pyoutput(feature)

The above code will read the jpeg or tiff file specified in the input attribute "image_filename" and add any metadata tags as feature attributes, e.g.:

`Image Make' has value `GoPro'
`Image Model' has value `HERO3+ Black Edition'
`Image Orientation' has value `Horizontal (normal)'
Badge +16
Learned something new today!

 

Directory and File Pathnames and SystemCaller with IrfanView results in nice data:

 

"D:\apps\IrfanView\i_view32.exe @Value(path_windows) /info=@Value(path_directory_windows)\@Value(path_rootname).txt /fullinfo"
Discovered that both tools do the job of extracting the exif information, nice one @nielsgerrits

 

 

Tried it myself and the result is this Template.

 

exifmetadata.fmwt

Reply