Edit field names
set_edits changes a photo’s edits by field name, such as exposure_ev or glow.size.
Ask DarkRay for the names rather than keeping a list: get_edits returns every field it can
change, with its value and range, for the photo you name.
Read a photo’s fields
Section titled “Read a photo’s fields”app.get_edits(id) returns an EditFields with four parts:
| Part | Holds |
|---|---|
fields |
Every field set_edits takes, by name, each with its current value |
sections |
Each section’s name, and whether it is on |
read_only |
Values only presets, copying edits and section resets change |
local_layers |
How many local layers the photo has; the MCP tools change only the Base |
A number field also carries min, max, decimals (the digits the panel shows) and
default (what a double-click on its slider returns to). A switch carries only its value,
true or false. A field with a fixed list of values would carry choices; none has one
now.
edits.value(name) reads one value:
from darkray_bridge import DarkRay
with DarkRay.connect() as app: ids = [photo.id for photo in app.iter_photos("kw:interior rating:>=3")]
# Find the photos whose Base exposure was pushed more than a stop. bright = [] for photo_id in ids: edits = app.get_edits(photo_id) if edits.value("exposure_ev") > 1.0: bright.append(photo_id)
app.update_photos(bright, add_keywords=["check exposure"])List every field
Section titled “List every field”This script prints every field with its range, and the section names:
from darkray_bridge import DarkRay
with DarkRay.connect() as app: photo_id = app.search_photos("", limit=1).photos[0].id edits = app.get_edits(photo_id)
# Every field set_edits takes, with its range, or "on/off" for a switch. for name, info in sorted(edits.fields.items()): if "min" in info: print(f"{name}: {info['value']} ({info['min']} to {info['max']}, default {info['default']})") elif "choices" in info: print(f"{name}: {info['value']} (one of {', '.join(info['choices'])})") else: print(f"{name}: {'on' if info['value'] else 'off'}")
# Section names, for set_edits' reset and copy_edits' sections. print(", ".join(edits.sections))How the names read
Section titled “How the names read”Names follow the Edit panel’s controls. Some you’ll use often:
| Field | Control | Range |
|---|---|---|
exposure_ev |
Exposure, in stops | −5 to 5 |
temperature, tint |
Temperature in kelvin, Tint | 2500 to 12000; −150 to 150 |
highlights, shadows, brightness, clarity |
Tone sliders | −100 to 100 |
vibrance, saturation |
Color sliders | −100 to 100 |
look_amount |
The look’s Amount | 0 to 100 |
vignette_amount |
Vignette amount | −100 to 100 |
sharpen.amount, glow.size, haze.amount |
An effect’s slider, named effect.control |
Each its own |
basic_enabled, glow_enabled, … |
A section’s power button | On or off |
monochrome_enabled |
Monochrome | On or off |
A dotted name, such as glow.size, is a control inside an effect’s section. A name ending in
_enabled is a switch, usually a section’s power button.
Change fields
Section titled “Change fields”set_edits takes three kinds of change, applied in this order:
reset: section names put back to their defaults. A reset leaves the section’s power button, the lens profile switch and the chosen lens as they are, and abasicreset puts the white balance back to the photo’s as-shot temperature.values: fields set to new values. A value outside the field’s range is refused with the range, and nothing changes.adjust: amounts added to number fields, each from that photo’s own value. A result past the range stops at its end, and the photo is listed in the result’slimited.
The section names are:
| Section | In the Edit panel |
|---|---|
lens, denoise |
RAW Process: lens corrections, AI denoise |
profile, monochrome |
Profile, and its Monochrome row |
color_profile |
Color Primaries |
crop |
Framing |
vignette |
Vignette |
look |
Look |
basic, agx |
General: Basic Color and Tone Mapping |
tone_curve |
Curves |
color_mixer |
Color Adjust |
color_grade |
Color Grading |
sharpen, halation, glow, haze |
Sharpen, Halation, Exponential Glow, Atmosphere |
copy_edits takes the same names in its sections.
Technical details: read-only values and the field table
read_only holds what can’t be set by name, as the photo’s edit document stores it: the
curves (curve_rgb, curve_r, curve_g, curve_b), the Color Adjust’s color_edits, the
grading wheels (color_grade_shadows, color_grade_mids, color_grade_highlights) and the
centers between their ranges (color_grade_t1, color_grade_t2), the crop, the orientation, the as-shot
temperature (source_temp), profile_id, look_id, the chosen lens
(lens_override_lens), and the model choice (denoise_model). Presets (apply_preset), copy_edits and resets change them.
One table in DarkRay (app/engine/edit_fields.py) declares every settable field and its
range, and the Edit panel builds its sliders from the same table, so the panel and
get_edits can’t disagree. Values are stored as the panel’s are: a number becomes a decimal.