pydngconverter.main

PyDNGConverter main module.

Classes

DNGConverter(source[, dest, max_workers, debug])

Python Interface to Adobe DNG Converter.

class pydngconverter.main.DNGConverter(source, dest=None, max_workers=None, debug=False, **params)

Bases: object

Python Interface to Adobe DNG Converter.

Takes the same parameters as the Adobe DNG Converter, but uses enums and such to make it easier to use.

Parameters

source (Union[str, Path]) – Path to source directory containing raw files

Keyword Arguments
  • dest – Path to destination. Defaults to source directory.

  • max_workers – Set maximum number of workers. Defaults to CPU core count.

  • debug – Enable debug logs and benchmarking. Defaults to false.

  • compression (flags.DNGVersion) – Enable DNG compression. Defaults to true.

  • camera_raw (flags.CRawCompat) – Camera RAW compatibility version. Defaults to latest.

  • dng_version (flags.DNGVersion) – DNG backwards compatible version. Defaults to latest.

  • jpeg_preview (flags.JPEGPreview) – JPEG preview thumbnail quality/method. Defaults to medium quality.

  • fast_load (bool) – Embed fast load data. Defaults to false.

  • lossy (flags.LossyCompression) – Enable lossy compression. Defaults to flags.LossyCompression.NO.

  • side (int) – Long-side pixels (32-65000). Implies lossy compression.

  • count (int) – Megapixels limit of >= 1024 (1MP). Implies lossy compression.

  • linear (bool) – Enable linear DNG format. Defaults to false.

Raises
  • FileNotFoundError – Executable program cannot be found.

  • NotADirectoryError – Source directory does not exist or is not a directory.

async convert()

Recursively convert all files in source directory.

async convert_file(*, destination=None, job=None, log=None)

Execute provided conversion job.

Parameters
  • destination (Optional[str]) – Output path.

  • job (Optional[DNGJob]) – DNG Converter job to run.

  • log – Logger to use.

async create_worker(name)

Create job execution worker.

Parameters

name (str) – friendly name for worker.

async extract_thumbnail(*, job=None, log=None, **kwargs)

Extract jpeg thumbnail from exif data.

Required exiftool to be installed.

Parameters
  • job (Optional[DNGJob]) – DNG Converter job.

  • log – Logger to use.

Return type

Path

Returns

Path to thumbnail.

property will_extract

Whether to create thumbnail extraction jobs or not.

Return type

bool