Exiftool By Phil

As an alternative to the 'single EXE' Windows ExifTool offered at Phil Harvey's site, I offer here a convenient installer and a robust portable package of Phil Harvey's ExifTool for Windows - probably the most comprehensive tool available for accessing metadata in image and other files. ExifTool by Phil Harvey (philharvey66 at gmail.com) ExifTool is a customizable set of Perl modules plus a full-featured command-line application for reading and writing meta information in a wide variety of files, including the maker note information of many digital cameras by various manufacturers such as Canon, Casio, DJI, FLIR, FujiFilm, GE, HP, JVC/Victor, Kodak, Leaf, Minolta/Konica.

PyExifTool is a Python library to communicate with an instance of PhilHarvey’s excellent ExifTool command-line application. The libraryprovides the class ExifTool that runs the command-linetool in batch mode and features methods to send commands to thatprogram, including methods to extract meta-information from one ormore image files. Since exiftool is run in batch mode, only asingle instance needs to be launched and can be reused for manyqueries. This is much more efficient than launching a separateprocess for every single query.

Product description First of all, thank you very much to Phil Harvey who makes a powerful editor application to process the photo, document, file's metadata on Linux, MAC or Window. We're mentioning his introduce ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta informati.

Jan 22, 2016 ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in a wide variety of files. By Phil Harvey ExifTool is a platform-independent command-line application for reading, writing, and editing Meta information that is contained by image, audio and video files.

The source code can be checked out from the github repository with

Alternatively, you can download a tarball. There haven’t been anyreleases yet.

PyExifTool is licenced under GNU GPL version 3 or later.

Example usage:

class exiftool.ExifTool(executable_=None)

Run the exiftool command-line tool and communicate to it.

You can pass the file name of the exiftool executable as anargument to the constructor. The default value exiftool willonly work if the executable is in your PATH.

Most methods of this class are only available after callingstart(), which will actually launch the subprocess. Toavoid leaving the subprocess running, make sure to callterminate() method when finished using the instance.This method will also be implicitly called when the instance isgarbage collected, but there are circumstance when this won’t everhappen, so you should not rely on the implicit processtermination. Subprocesses won’t be automatically terminated ifthe parent process exits, so a leaked subprocess will stay arounduntil manually killed.

A convenient way to make sure that the subprocess is terminated isto use the ExifTool instance as a context manager:

Warning

Note that there is no error handling. Nonsensicaloptions will be silently ignored by exiftool, so there’s notmuch that can be done in that regard. You should avoid passingnon-existent files to any of the methods, since this will leadto undefied behaviour.

running

A Boolean value indicating whether this instance is currentlyassociated with a running subprocess.

execute(*params)

Execute the given batch of parameters with exiftool.

This method accepts any number of parameters and sends them tothe attached exiftool process. The process must berunning, otherwise ValueError is raised. The final-execute necessary to actually run the batch is appendedautomatically; see the documentation of start() forthe common options. The exiftool output is read up to theend-of-output sentinel and returned as a raw bytes object,excluding the sentinel.

The parameters must also be raw bytes, in whateverencoding exiftool accepts. For filenames, this should be thesystem’s filesystem encoding.

Note

Exiftool by phil harvey

This is considered a low-level method, and shouldrarely be needed by application developers.

Exiftool by phil harvey video tutorial
execute_json(*params)

Execute the given batch of parameters and parse the JSON output.

This method is similar to execute(). Itautomatically adds the parameter -j to request JSON outputfrom exiftool and parses the output. The return value isa list of dictionaries, mapping tag names to the correspondingvalues. All keys are Unicode strings with the tag names,including the ExifTool group name in the format <group>:<tag>.The values can have multiple types. All strings occurring asvalues will be Unicode strings.

The parameters to this function must be either raw strings(type str in Python 2.x, type bytes in Python 3.x) orUnicode strings (type unicode in Python 2.x, type strin Python 3.x). Unicode strings will be encoded usingsystem’s filesystem encoding. This behaviour means you canpass in filenames according to the convention of therespective Python version – as raw strings in Python 2.x andas Unicode strings in Python 3.x.

get_metadata(filename)

Instagram. Return meta-data for a single file.

The returned dictionary has the format described in thedocumentation of execute_json().

get_metadata_batch(filenames)

Return all meta-data for the given files.

The return value will have the format described in thedocumentation of execute_json().

get_tag(tag, filename)

Extract a single tag from a single file.

The return value is the value of the specified tag, orNone if this tag was not found in the file.

get_tag_batch(tag, filenames)

Extract a single tag from the given files.

The first argument is a single tag name, as usual in theformat <group>:<tag>.

Exiftool

The second argument is an iterable of file names.

The return value is a list of tag values or None fornon-existent tags, in the same order as filenames.

get_tags(tags, filename)

Return only specified tags for a single file.

The returned dictionary has the format described in thedocumentation of execute_json().

get_tags_batch(tags, filenames)

Return only specified tags for the given files.

The first argument is an iterable of tags. The tag names mayinclude group names, as usual in the format <group>:<tag>.

The second argument is an iterable of file names.

The format of the return value is the same as forexecute_json().

start()

Start an exiftool process in batch mode for this instance.

This method will issue a UserWarning if the subprocess isalready running. The process is started with the -G and-n as common arguments, which are automatically includedin every command you run with execute().

terminate()

Terminate the exiftool process of this instance.

If the subprocess isn’t running, this method will do nothing.

exiftool.executable = 'exiftool'

Exiftool By Phil Harvey

The name of the executable to run.

If the executable is not located in one of the paths listed in thePATH environment variable, the full path should be given here.

exiftool.fsencode(filename)

Exiftool By Phil Harvey

Encode filename to the filesystem encoding with ‘surrogateescape’ errorhandler, return bytes unchanged. On Windows, use ‘strict’ error handler ifthe file system encoding is ‘mbcs’ (which is the default encoding).