checksit.readers.image

Reader for image files.

Functions

get_output(cmd)

Get the output of a shell command.

read(fpath[, verbose])

Read an image file and return an ImageParser object.

Classes

ImageParser(inpt[, verbose])

Parse an image file into dictionaries.

class checksit.readers.image.ImageParser(inpt: str, verbose: bool = False)[source]

Parse an image file into dictionaries.

Extract information from an image file into a dictionary for tags, labelled as global_attributes for use within checksit. This uses exiftool to extract the metadata from the image file.

inpt

The input file path.

verbose

Print verbose output during parsing.

base_exiftool_arguments

The arguments to pass to exiftool.

global_attrs

The tag name and values from the image file.

exiftool_location

The location on the machine of the exiftool executable.

global_attrs

The metadata tags and values extracted from the image file.

to_dict() Dict[str, str | Dict[str, str]][source]

Convert the ImageParser object data to a dictionary.

Returns:

Dictionary containing metadata tags and values as “global_attributes”, and

the input file path as “inpt”.

checksit.readers.image.get_output(cmd: str) Tuple[str, str][source]

Get the output of a shell command.

Parameters:

cmd – The shell command to run.

Returns:

The output of the shell command.

checksit.readers.image.read(fpath: str, verbose: bool = False) ImageParser[source]

Read an image file and return an ImageParser object.

Parameters:
  • fpath – The path to the image file.

  • verbose – Print verbose output during parsing.

Returns:

An ImageParser object containing the metadata tags and values.