Setups
parent
e1e0a8a5d4
commit
8e92c0c14e
|
@ -0,0 +1,3 @@
|
||||||
|
/node_modules
|
||||||
|
*.lock
|
||||||
|
*.md.backup
|
113
README.md
113
README.md
|
@ -22,24 +22,15 @@ npm i --save rawtherapee
|
||||||
yarn add rawtherapee
|
yarn add rawtherapee
|
||||||
```
|
```
|
||||||
|
|
||||||
## Simple Usage
|
## Usage
|
||||||
|
|
||||||
```js
|
_Promise_ = rawtherapee(_url_ | _array_ `targets` [, _object_ `options`])
|
||||||
const rawtherapee = require("rawtherapee");
|
|
||||||
|
|
||||||
rawtherapee("/somewhere/something.NEF").then((files) => {
|
* `targets`: files or directories
|
||||||
// `files` is an array containing all processed file paths.
|
* `options`: simple options _Object_
|
||||||
console.log(files.length, "files processed.");
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
| option | format | values | default |
|
|
||||||
|!===|===|===|===|
|
|
||||||
| replace | _boolean_ | | |
|
|
||||||
|
|
||||||
|
|
||||||
#### `replace`
|
#### `replace`
|
||||||
|
|
||||||
*default: `false`*
|
*default: `false`*
|
||||||
|
@ -51,12 +42,23 @@ Replace the existing output file.
|
||||||
|
|
||||||
*default: `false`*
|
*default: `false`*
|
||||||
|
|
||||||
|
Process all raw and non raw formats, igroring GUI parameters.
|
||||||
|
|
||||||
|
|
||||||
#### `presets`
|
#### `presets`
|
||||||
|
|
||||||
*default: `['default']`*
|
*default: `['default']`*
|
||||||
|
|
||||||
'sidecar', 'sidecar-strict', '<uri>'
|
An array of pp3 presets files.
|
||||||
|
|
||||||
|
Possible opions:
|
||||||
|
|
||||||
|
* `'default'`: use the default preset selected in GUI.
|
||||||
|
* `'sidecar'`: use the sidecar file of each image if available
|
||||||
|
* `'sidecar-strict'`: like `'sidecar`, but return an error if there is no sidecar.
|
||||||
|
* `<uri>`: any pp3 file in your system
|
||||||
|
|
||||||
|
`rawtherapee-cli` always use the neutral presets as base, then apply presets in the order you passed it.
|
||||||
|
|
||||||
|
|
||||||
#### `ignoreBadPreset`
|
#### `ignoreBadPreset`
|
||||||
|
@ -66,16 +68,20 @@ Replace the existing output file.
|
||||||
If set to `false`, any non-existing preset file passed to the `presets` parameter will throw an error.
|
If set to `false`, any non-existing preset file passed to the `presets` parameter will throw an error.
|
||||||
If set to `true`, those files will be ignored (not passed to `rawtherapi-cli`) and print message in `sterr` if the `DEBUG` environment variable is set to any value.
|
If set to `true`, those files will be ignored (not passed to `rawtherapi-cli`) and print message in `sterr` if the `DEBUG` environment variable is set to any value.
|
||||||
|
|
||||||
|
|
||||||
#### `output`
|
#### `output`
|
||||||
|
|
||||||
*default: `'/tmp/img'`*
|
*default: `'.'`*
|
||||||
|
|
||||||
|
File or directory where the processed files will be stored (directory must exists).
|
||||||
|
|
||||||
|
|
||||||
#### `format`
|
#### `format`
|
||||||
|
|
||||||
*default: `'jpg'`*
|
*default: `'jpg'`*
|
||||||
|
|
||||||
|
Possibles options:
|
||||||
|
|
||||||
`'jpg'`, `'png'` or `'tiff'`
|
`'jpg'`, `'png'` or `'tiff'`
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,13 +89,16 @@ If set to `true`, those files will be ignored (not passed to `rawtherapi-cli`) a
|
||||||
|
|
||||||
*default: `8`*
|
*default: `8`*
|
||||||
|
|
||||||
`16`, `16f` or `32`
|
Color depth of the output file. Only for TIFF and PNG formats.
|
||||||
Only for TIFF and PNG output formats.
|
|
||||||
|
Possibles options:
|
||||||
|
|
||||||
|
`8` or `16`
|
||||||
|
|
||||||
|
|
||||||
#### `compression`
|
#### `compression`
|
||||||
|
|
||||||
*default: `92`*
|
*default: `90`*
|
||||||
|
|
||||||
Only for JPG output formats (PNG compression is hardcoded at 6 in `rawtherapi-cli`)
|
Only for JPG output formats (PNG compression is hardcoded at 6 in `rawtherapi-cli`)
|
||||||
|
|
||||||
|
@ -98,9 +107,13 @@ Only for JPG output formats (PNG compression is hardcoded at 6 in `rawtherapi-cl
|
||||||
|
|
||||||
_string_ or _int_
|
_string_ or _int_
|
||||||
|
|
||||||
*default:`'4:2:2'`*
|
*default:`2`*
|
||||||
|
|
||||||
`1`, `'4:2:0'`, `2`, `'4:4:4'`, `3`
|
Possibles options:
|
||||||
|
|
||||||
|
* `'4:2:2'` or `1`
|
||||||
|
* `'4:2:0'` or `2`
|
||||||
|
* `'4:4:4'` or `3`
|
||||||
|
|
||||||
|
|
||||||
#### `zip`
|
#### `zip`
|
||||||
|
@ -109,7 +122,7 @@ _boolean_
|
||||||
|
|
||||||
*default: `false`*
|
*default: `false`*
|
||||||
|
|
||||||
Only for TIFF output format.
|
Use TIFF zip compression.
|
||||||
|
|
||||||
|
|
||||||
#### `onChange`
|
#### `onChange`
|
||||||
|
@ -117,8 +130,62 @@ Only for TIFF output format.
|
||||||
_function_
|
_function_
|
||||||
*default: `() => {}`*
|
*default: `() => {}`*
|
||||||
|
|
||||||
Callback _function_ fired every time the status is updated (not based on `EventListener`) :
|
Callback _function_ fired every time the status is updated (not using `EventListeners`) :
|
||||||
|
|
||||||
Return a simple object who always contains `status` entry, and maybe `file` or `code`.
|
Return a simple object who always contains `status`, and maybe `file` or `code`.
|
||||||
|
|
||||||
|
Status can be :
|
||||||
|
|
||||||
|
* `start`: start running `rawtherapee-cli`.
|
||||||
|
* `skipped`: skip ignored `file` in a full directory process.
|
||||||
|
* `processing`: start processing `file`.
|
||||||
|
* `complete`: processing `file` completed.
|
||||||
|
* `idle`: `rawtherapee-cli` stop with `code` code.
|
||||||
|
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
const rawtherapee = require('rawtherapee')
|
||||||
|
|
||||||
|
rawtherapee('/somewhere/something.NEF')
|
||||||
|
.then((files) => {
|
||||||
|
console.log(files.length, 'files processed.')
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
const fs = require('fs')
|
||||||
|
const rawtherapee = require('rawtherapee')
|
||||||
|
|
||||||
|
const output = '/tmp/img'
|
||||||
|
|
||||||
|
if (!fs.existsSync(output)) fs.mkdirSync(output)
|
||||||
|
|
||||||
|
const onChange = (state) => {
|
||||||
|
switch (state.status) {
|
||||||
|
case 'complete':
|
||||||
|
console.log(state.file, 'process done.')
|
||||||
|
break
|
||||||
|
case 'skipped':
|
||||||
|
console.log(state.file, 'have been ignored.')
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
console.log('Event', state.status, 'fired.', state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rawtherapee([
|
||||||
|
'/somewhere/something.NEF',
|
||||||
|
'/somewhereelse/somethingelse.NEF'
|
||||||
|
], {
|
||||||
|
onChange,
|
||||||
|
output,
|
||||||
|
format: 'tiff',
|
||||||
|
depth: 16,
|
||||||
|
zip: true,
|
||||||
|
preset: ['sidecar']
|
||||||
|
})
|
||||||
|
.then((files) => console.log(files.length, 'files processed.'))
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "rawtherapee",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "rawtherapee-cli wrapper to process RAW images in NodeJs",
|
||||||
|
"repository": "https://github.com/clovfr/node-rawtherapee",
|
||||||
|
"author": "Clovis Gauzy",
|
||||||
|
"license": "BSD-3",
|
||||||
|
"private": true,
|
||||||
|
"main": "rawtherapee.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "standard"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"standard": "*"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue