Media Intermediate Reviewed syntax

Batch Photo Processing

Convert a directory of RAW files into JPEG output and then regenerate a gallery page from the resulting images. This example shows how Netsuke fans one rule over many files and still finishes with a single top-level artefact.

Directory Structure

photo-workflow/
raw_photos/
IMG_1001.CR2
IMG_1002.CR2
processed/
Netsukefile

The manifest declares the photo set once, writes converted JPEGs into `processed/`, then rebuilds `processed/gallery.html` from the converted outputs.

Why it matters

`foreach` stamps out one target per entry, so a growing photo set stays a one-line change while still compiling to a static Ninja graph. Use `glob('raw_photos/*.CR2')` instead when the set should track the filesystem.

Annotated Manifest

examples/photo_edit.yml
netsuke_version: "1.0.0"

vars:
  out_dir: processed
  photos:
    - portrait
    - landscape

rules:
  - name: convert_raw
    command: "darktable-cli {{ ins }} {{ outs }} --core --width 100% --height 100% --quality 92"
    description: "Converting RAW photo"

  - name: make_gallery
    command: "make-gallery {{ out_dir }} > {{ outs }}"

targets:
  - name: "{{ out_dir }}"
    command: "mkdir -p {{ outs }}"

  - foreach: photos
    name: "{{ out_dir }}/{{ item }}.jpg"
    rule: convert_raw
    sources: "raw_photos/{{ item }}.CR2"
    order_only_deps: "{{ out_dir }}"

  - name: "{{ out_dir }}/gallery.html"
    rule: make_gallery
    sources:
      - "{{ out_dir }}/portrait.jpg"
      - "{{ out_dir }}/landscape.jpg"
    order_only_deps: "{{ out_dir }}"
    always: true

actions:
  - name: preview
    script: |
      feh {{ out_dir }} &

defaults:
  - processed/gallery.html
1

One target template, many outputs

`foreach` walks the `photos` list and stamps out one JPEG target per input.

2

The gallery target is marked `always`

The HTML page should always refresh when invoked, even if the output file already exists.

3

Actions stay outside the default graph

`preview` is useful, but it is not part of the build product. Actions let the manifest describe both.

Running the Build

Terminal
$ netsuke build processed/gallery.html
[1/4] mkdir -p processed
[2/4] Converting RAW photo
[3/4] Converting RAW photo
[4/4] make-gallery processed > processed/gallery.html

Build Flow

1. Declare

List the photo names once in `vars.photos`.

2. Convert

Run `darktable-cli` once per source file.

3. Gather

The gallery target lists the converted JPEGs as sources.

4. Publish

Write `processed/gallery.html` from the output set.