Retrieve and update darktable operations params stored in sidecar xmp files. This helps automate image processing with darktable-cli
Tested on: MacOS and Linux
$ npm install @wmakeev/darkroom-xmp-tools
Take some darktable XMP
...
<darktable:history>
<rdf:Seq>
...
<rdf:li
darktable:operation="exposure"
darktable:enabled="1"
darktable:modversion="5"
darktable:params="0000000040a0093bd8ce374000004842000080c0"
darktable:multi_name="1"
darktable:multi_priority="0"
darktable:blendop_version="7"
darktable:blendop_params="gz12eJxjYGBgkGAAgRNODESDBnsIHll8ANNSGQM="/>
...
<rdf:Seq>
</darktable:history>
...
add some code
const assert = require('assert')
const { decodeExposureParams, encodeExposureParams } = require('@wmakeev/darkroom-xmp-tools')
// from XMP darktable:params
const EXPOSURE_PARAMS_BIN_STR = '0000000040a0093bd8ce374000004842000080c0'
let paramsObj = decodeExposureParams(EXPOSURE_PARAMS_BIN_STR)
console.log('exposureParams:', JSON.stringify(paramsObj))
// "exposureParams": {
// "mode": "EXPOSURE_MODE_MANUAL",
// "black": 0.0021000057458877563,
// "exposure": 2.871999740600586,
// "deflickerPercentile": 50,
// "deflickerTargetLevel": -4
// }
// before encode you can modify paramsObj ...
let encodedParamsStr = encodeExposureParams(paramsObj)
// ... and update exposure darktable:params in XMP file with new value
assert.strictEqual(encodedParamsStr, EXPOSURE_PARAMS_BIN_STR)
-
decodeSharpenParams (encoded: string): SharpenParams
-
encodeSharpenParams (params: SharpenParams): string
-
decodeLevelsParams (encoded: string): LevelsParams
-
encodeLevelsParams (params: LevelsParams): string
-
decodeShadhiParams (encoded: string): ShadhiParams
-
encodeShadhiParams (params: ShadhiParams): string
-
decodeExposureParams (encoded: string): ExposureParams
-
encodeExposureParams (params: ExposureParams): string
-
decodeBlendParams (encoded: string): BlendParams
-
encodeBlendParams (params: BlendParams): string
-
decodeClippingParams (encoded: string): ClippingParams
-
encodeClippingParams (params: ClippingParams): string
-
decodeDefringeParams (encoded: string): DefringeParams
-
encodeDefringeParams (params: DefringeParams): string
-
decodeFlipParams (encoded: string): FlipParams
-
encodeFlipParams (params: FlipParams): string
-
decodeBasecurveParams (encoded: string): Basecurve
-
encodeBasecurveParams (params: Basecurve): string
-
decodeParams (operation: 'sharpen', encodedParams: string): SharpenParams
-
decodeParams (operation: 'levels', encodedParams: string): LevelsParams
-
decodeParams (operation: 'shadhi', encodedParams: string): ShadhiParams
-
decodeParams (operation: 'exposure', encodedParams: string): ExposureParams
-
decodeParams (operation: 'blend', encodedParams: string): BlendParams
-
decodeParams (operation: 'clipping', encodedParams: string): ClippingParams
-
decodeParams (operation: 'defringe', encodedParams: string): DefringeParams
-
decodeParams (operation: 'flip', encodedParams: string): FlipParams
-
decodeParams (operation: 'basecurve', encodedParams: string): BasecurveParams
-
encodeParams (operation: string, params: Params): string
-
decodeMaskPoints<MaskPoint> (maskType: string, numberPoints: number, encodedPoints: string): Array<MaskPoint>
-
encodeMaskPoints<MaskPoint> (maskType: string, points: Array<MaskPoint>): string
-
decodeCircleMask (encodedMask: string): MaskCirclePoint
-
encodeCircleMask (mask: MaskCirclePoint): string
-
decodeEllipseMask (encodedMask: string): MaskEllipsePoint
-
encodeEllipseMask (mask: MaskEllipsePoint): string
-
decodeGradientMask (encodedMask: string): MaskGradientPoint
-
encodeGradientMask (mask: MaskGradientPoint): string
- Windows support?
- Improve errors messages and arguments validation
- Fix Typescript typings
- Add Travis build
- Add Linux support
- Add some arguments validation
- Fix some bugs