Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ExifTool

Manages delegating calls to a vendored running instance of ExifTool.

Instances should be shared: consider using the exported singleton instance of this class, exiftool.

Hierarchy

  • ExifTool

Index

Constructors

constructor

Properties

options

Accessors

ended

  • get ended(): boolean
  • Returns boolean

    true if .end() has been invoked

pendingTasks

  • get pendingTasks(): number
  • Returns number

    the number of pending (not currently worked on) tasks

pids

  • get pids(): Promise<number[]>
  • Returns Promise<number[]>

    the currently running ExifTool processes. Note that on Windows, these are only the process IDs of the directly-spawned ExifTool wrapper, and not the actual perl vm. This should only really be relevant for integration tests that verify processes are cleaned up properly.

Methods

end

  • end(gracefully?: boolean): Promise<void>
  • Shut down running ExifTool child processes. No subsequent requests will be accepted.

    This may need to be called in after or finally clauses in tests or scripts for them to exit cleanly.

    Parameters

    • Default value gracefully: boolean = true

    Returns Promise<void>

enqueueTask

  • enqueueTask<T>(task: function): Promise<T>
  • enqueueTask is not for normal consumption. External code can extend Task to add functionality.

    Type parameters

    • T

    Parameters

    Returns Promise<T>

extractBinaryTag

  • extractBinaryTag(tagname: string, src: string, dest: string): Promise<void>
  • Extract a given binary value from "tagname" tag associated to path/to/image.jpg and write it to dest (which cannot exist and whose directory must already exist).

    Parameters

    • tagname: string
    • src: string
    • dest: string

    Returns Promise<void>

    a Promise<void>. An Error is raised if the binary output not be written to dest.

extractJpgFromRaw

  • extractJpgFromRaw(imageFile: string, outputFile: string): Promise<void>
  • Extract the "JpgFromRaw" image in path/to/image.jpg and write it to path/to/fromRaw.jpg.

    This size of these images varies widely, and is not present in all RAW images. Nikon and Panasonic use this tag.

    Parameters

    • imageFile: string
    • outputFile: string

    Returns Promise<void>

    a Promise<void>. An Error is raised if the file could not be read or the output not written.

extractPreview

  • extractPreview(imageFile: string, previewFile: string): Promise<void>
  • Extract the "preview" image in path/to/image.jpg and write it to path/to/preview.jpg.

    The size of these images varies widely, and is present in dSLR images. Canon, Fuji, Olympus, and Sony use this tag.

    Parameters

    • imageFile: string
    • previewFile: string

    Returns Promise<void>

    a Promise<void>. An Error is raised if the file could not be read or the output not written.

extractThumbnail

  • extractThumbnail(imageFile: string, thumbnailFile: string): Promise<void>
  • Extract the low-resolution thumbnail in path/to/image.jpg and write it to path/to/thumbnail.jpg.

    Note that these images can be less than .1 megapixels in size.

    Parameters

    • imageFile: string
    • thumbnailFile: string

    Returns Promise<void>

    a Promise<void>. An Error is raised if the file could not be read or the output not written.

on

  • on(event: any, listener: any): void
  • Register lifecycle event listeners. Delegates to BatchProcess.

    Parameters

    • event: any
    • listener: any

    Returns void

read

  • read(file: string, args?: string[]): Promise<Tags>
  • Read the tags in file.

    memberof

    ExifTool

    Parameters

    • file: string

      the file to extract metadata tags from

    • Default value args: string[] = ["-fast"]

    Returns Promise<Tags>

    A resolved Tags promise. If there are errors during reading, the .errors field will be present.

rewriteAllTags

  • rewriteAllTags(inputFile: string, outputFile: string, allowMakerNoteRepair?: boolean): Promise<void>
  • Attempt to fix metadata problems in JPEG images by deleting all metadata and rebuilding from scratch. After repairing an image you should be able to write to it without errors, but some metadata from the original image may be lost in the process.

    This should only be applied as a last resort to images whose metadata is not readable via {@link .read()}.

    see

    http://owl.phy.queensu.ca/~phil/exiftool/faq.html#Q20

    Parameters

    • inputFile: string

      the path to the problematic image

    • outputFile: string

      the path to write the repaired image

    • Default value allowMakerNoteRepair: boolean = false

      if there are problems with MakerNote tags, allow ExifTool to apply heuristics to recover corrupt tags. See exiftool's -F flag.

    Returns Promise<void>

    resolved when outputFile has been written.

version

  • version(): Promise<string>
  • Returns Promise<string>

    a promise holding the version number of the vendored ExifTool

write

  • write(file: string, tags: WriteTags, args?: string[]): Promise<void>
  • Write the given tags to file.

    memberof

    ExifTool

    Parameters

    • file: string

      an existing file to write tags to.

    • tags: WriteTags

      the tags to write to file.

    • Optional args: string[]

    Returns Promise<void>

    Either the promise will be resolved if the tags are written to successfully, or the promise will be rejected if there are errors or warnings.

Generated using TypeDoc