The named image operations PhoenixKitAI.Images.process/4 composes
into one edit prompt.
An operation is a prompt template plus, optionally, parameters it
needs, request options it implies (a transparent cutout wants
background: "transparent" and a PNG), a fallback template for when
those options are not available on the model, presets for a
parameter, and whether it needs reference images after the subject.
Built-ins
| operation | parameters | notes |
|---|---|---|
:instruction | text | free text; a bare string in the list means this |
:clean_background | color (default "white") | plain studio backdrop |
:blur_background | shallow depth of field | |
:remove_background | transparent PNG; falls back to plain white | |
:replace_background | with | described new background |
:remove_reflections | glare and specular highlights | |
:remove_objects | what | remove and fill |
:enhance | exposure, white balance, sharpness | |
:upscale | resolution (default "2K") | asks for a bigger output |
:relight | light (preset atom or text) | :day, :evening, :night, :studio, :golden_hour, :overcast |
:recolor | what, color | one element's colour |
:straighten | level horizon, vertical verticals | |
:crop_to_subject | tight crop, even margins | |
:restyle | needs reference images; borrows their materials and mood |
Extending
A host adds or overrides operations in config:
config :phoenix_kit_ai, image_operations: %{
product_shot: %{
description: "Catalogue product shot",
prompt: "Place the product on a seamless white sweep with soft studio light.",
options: %{aspect_ratio: "1:1"}
}
}And an admin can override any operation's wording without a deploy:
a saved prompt named Image op <name> — its slug, derived from the
name, is image-op-<name> with dashes, e.g. a prompt called
"Image op remove background" — replaces the built-in template; its
{{Variables}} are filled from the operation's parameters.
Summary
Functions
Every operation: built-ins under the host's :image_operations.
One operation's spec.
The translated label of a built-in operation (its description for a
host-defined one). The literals here are what the extractor sees, so
every built-in name lands in the catalogue.
Operation names, built-ins first.
Turns the caller's list into [{name, params}].
The request options the operations imply (later operations win).
Whether any operation in the list needs reference images.
The sentence(s) for one operation. fallback: true picks the
operation's fallback wording (its implied options were not available).
A saved prompt whose slug is image-op-<name> (a prompt named
"Image op <name>") overrides the template unless
prompt_overrides: false.
Types
@type name() :: atom()
@type spec() :: %{ :prompt => String.t(), optional(:description) => String.t(), optional(:params) => [atom()], optional(:defaults) => params(), optional(:options) => map(), optional(:fallback_prompt) => String.t(), optional(:presets) => %{optional(atom()) => String.t()}, optional(:references) => :none | :optional | :required, optional(:group) => atom() }
Functions
Every operation: built-ins under the host's :image_operations.
One operation's spec.
The translated label of a built-in operation (its description for a
host-defined one). The literals here are what the extractor sees, so
every built-in name lands in the catalogue.
@spec names() :: [name()]
Operation names, built-ins first.
@spec normalize([term()]) :: {:ok, [{name(), params()}]} | {:error, {:unknown_operation, term()} | {:missing_parameter, name(), atom()} | {:conflicting_operations, name(), name()}}
Turns the caller's list into [{name, params}].
Accepts atoms (:enhance), tuples with keyword or map parameters
({:relight, light: :night}), bare strings (a free-form instruction),
and {:custom, "text"}. Unknown names, missing parameters and two
operations from one exclusive group (two background treatments, say)
are errors before anything is sent.
The request options the operations imply (later operations win).
Whether any operation in the list needs reference images.
The sentence(s) for one operation. fallback: true picks the
operation's fallback wording (its implied options were not available).
A saved prompt whose slug is image-op-<name> (a prompt named
"Image op <name>") overrides the template unless
prompt_overrides: false.