pydngconverter

PyDngConverter

A Python Interface to Adobe’s DNG Converter.

Uses parallel processing and Image manipulation to significantly speed up the process of converting RAW images to DNG.

class pydngconverter.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

class pydngconverter.DNGParameters(compression=<Compression.YES: 'c'>, camera_raw=<CRawCompat.ELEVEN_TWO: 11.2>, dng_version=<DNGVersion.ONE_FOUR: 1.4>, jpeg_preview=<JPEGPreview.MEDIUM: 1>, fast_load=False, lossy=<LossyCompression.NO: ''>, side=0, count=0, linear=False)

Bases: object

Adobe DNG Converter Parameters.

compression

Enable DNG compression. Defaults to true.

Type

flags.DNGVersion

camera_raw

Camera RAW compatibility version. Defaults to latest.

Type

flags.CRawCompat

dng_version

DNG backwards compatible version. Defaults to latest.

Type

flags.DNGVersion

jpeg_preview

JPEG preview thumbnail quality/method. Defaults to medium quality.

Type

flags.JPEGPreview

fast_load

Embed fast load data. Defaults to false.

Type

bool

lossy

Enable lossy compression. Defaults to flags.LossyCompression.NO.

Type

flags.LossyCompression

side

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

Type

int

count

Megapixels limit of >= 1024 (1MP). Implies lossy compression.

Type

int

linear

Enable linear DNG format. Defaults to false.

Type

bool

camera_raw: pydngconverter.flags.CRawCompat = 11.2
compression: pydngconverter.flags.Compression = 'c'
count: Optional[int] = 0
dng_version: pydngconverter.flags.DNGVersion = 1.4
fast_load: bool = False
property fast_load_flag
Return type

Optional[str]

property iter_args
Return type

Iterator[str]

jpeg_preview: pydngconverter.flags.JPEGPreview = 1
linear: bool = False
property linear_flag
Return type

Optional[str]

lossy: pydngconverter.flags.LossyCompression = ''
side: Optional[int] = 0