PhotoFresco

v0.1.2
io.github.photofresco/photofresco Checked 3 days ago Published 27 days ago

Let AI agents edit images in a PhotoFresco window you approve: layers, masks, previews and export.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

photofresco_connect Connect to PhotoFresco

Open PhotoFresco in its own browser window on this computer and ask the user to allow this agent. The window shows a connection code; tell the user the code returned here so they can check it before clicking Allow. Inputs: access (optional) asks for permissions right away; document is "active" (default), "none" or a document_id; wait_seconds (default 40, at most 170) is how long this call waits for the user. Returns state "connected" with the session status, or state "pairing" with the code while the user has not decided yet: call photofresco_connect again to keep waiting (the request expires…

ParameterTypeDescription
accessobjectPermissions to ask the user for once connected. Asking grants nothing; the user decides in the PhotoFresco window
documentstring"active" (default), "none", or a document_id from photofresco_documents
wait_secondsnumberSeconds to wait for the user's decision before returning the pending code (default 40)

photofresco_status PhotoFresco status

Connection state, the pending connection code, the session (target document_id, revision, granted permissions, pending permission request, credit budget, pause state), folders granted for import/export and the enabled tool groups. Inputs: none. Effect: reads state only; never starts a browser.

photofresco_request_access Ask the user for permissions

Ask the user for permissions in the PhotoFresco window (replaces any pending request). The user may grant fewer; nothing is granted until they click Allow there. Tools appear as permissions arrive (tools/list_changed); photofresco_status shows grants and the pending request. Inputs: capabilities (required), budget_credits (required with spend, 1–100000 credits), reason (shown to the user, at most 200 characters). Effect: shows a request in the editor; changes no document. Needs a connected session.

ParameterTypeDescription
capabilities *arrayPermissions to ask for: read (see the document and previews), edit (change documents, open/close tabs), export (files leave the editor), external-write (send data to PhotoFresco services), spend (paid…
budget_creditsintegerCredit budget for paid AI (required with spend)
reasonstringWhy, shown to the user (at most 200 characters)

photofresco_documents List open documents

Open documents in the PhotoFresco window: document_id, name, whether it is the active tab, revision, which agent controls it and whether it is paused. Inputs: none. Effect: reads state only. Needs a connected session.

photofresco_attach Target a document

Make this session target another open document by document_id (from photofresco_documents). Operations run only while the target is the active tab, so ask the user to switch tabs if needed. Inputs: document (required). Effect: changes the session target; no document edit. Needs a connected session.

ParameterTypeDescription
document *stringdocument_id to target

photofresco_disconnect Disconnect from PhotoFresco

End this session (same as the user pressing Stop): in-flight work is interrupted, permissions are cleared, applied edits stay in History. The window stays open for the user unless close_window is true. Reconnecting needs the user's Allow again. Inputs: close_window (optional). Effect: ends the session; edits nothing.

ParameterTypeDescription
close_windowbooleanAlso close the PhotoFresco browser window this server opened

photofresco_list_tool_groups List PhotoFresco tool groups

The op groups this server can list as tools, which are enabled, and how many tools each adds now. Inputs: none. Effect: reads server state only.

photofresco_select_tool_groups Enable or disable tool groups

Enable or disable op groups to change which PhotoFresco operations are listed as tools (sends tools/list_changed). Use it when a needed operation is not listed. Listing never grants permissions. Inputs: enable, disable (group IDs from photofresco_list_tool_groups, or "all"). Effect: changes this server's tool list only.

ParameterTypeDescription
disablearrayGroups to remove
enablearrayGroups to add

adjust_add Adjustment: Add

Add a non-destructive adjustment layer above the active node. Types include brightness-contrast, levels, curves, exposure, hue-saturation, vibrance, color-balance, black-white, photo-filter, channel-mixer, gradient-map, selective-color, color-lookup, shadows-highlights, match-replace-color, invert, posterize, and threshold. Pass type-specific params in "params". Match color accepts source_layer_id/target_layer_id to sample RGB statistics. Set clipped=true (layer.set_props) to affect only the layer below. Inputs: adjustment_type (required), params. Units, ranges and allowed values are in the i…

adjust_set_params Adjustment: Set params

Update the active adjustment layer’s parameters (same shapes as adjust.add). Undoable. Inputs: params (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: adjust.set_params.

canvas_resize Canvas: Resize

Change canvas size without resampling; content shifts by (dx, dy) px (e.g. dx=(newW−oldW)/2 to center). Clears the selection. Undoable. Inputs: width (required), height (required), dx, dy. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revisio…

ParameterTypeDescription
height *numberNew height px
width *numberNew width px
dxnumberContent shift x (default 0)
dynumberContent shift y (default 0)

crop_apply Crop: Apply

Apply pending crop or set a rectangle then apply. Undoable. Inputs: x, y, width, height. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: crop.apply.

ParameterTypeDescription
heightnumberHeight
widthnumberWidth
xnumberDocument x
ynumberDocument y

doc_get_state Document: Get state

Get the full document state: document_id and content revision (agent sessions), dimensions, color mode, the layer tree (ids, names, kinds, blend modes, opacity, visibility, locks, pixel bounds), the active node id, and the current selection bounds. Call this first to orient yourself. Inputs: none. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: doc.get_state.

doc_histogram Document: Histogram

Return 256-bin histogram counts for the flattened visible document, restricted to the active selection when one exists. mode defaults to luminosity; rgb returns composite plus red/green/blue counts. Inputs: mode. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: do…

ParameterTypeDescription
modestringrgb, red, green, blue, or luminosity

doc_new Document: New

Create a new document tab. Width/height use unit (px, in, cm, mm) and resolution; background is white, transparent, or color. Inputs: name, width, height, unit, resolution, background, background_color, preset. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Opens, closes, duplicates or reverts documents (tabs); history_undo does not reverse it. Undo: not reversible with history_undo. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the…

ParameterTypeDescription
backgroundstringBackground contents
background_colorarray[r,g,b] when background=color
heightnumberHeight in the selected unit
namestringDocument name (default Untitled)
presetstringPreset id for UI bookkeeping
resolutionnumberPixels per inch for physical units
unitstringMeasurement unit
widthnumberWidth in the selected unit

doc_sample_color Document: Sample color

Read the flattened composite color at document coordinate (x, y). Returns RGB, RGBA, and HSB; does not change the foreground color. Inputs: x (required), y (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: doc.sample_color.

ParameterTypeDescription
x *numberDoc x
y *numberDoc y

edit_fill Edit: Fill

Fill the selection (or the whole canvas if none) on the active layer. Default contents=color uses color [r,g,b] or the current foreground; contents=pattern uses the active pattern or pattern_id. Inputs: contents, color, pattern_id, blend_mode, opacity. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns imme…

ParameterTypeDescription
blend_modestringPattern blend mode (default normal)
colorarray[r, g, b] each 0-255
contentsstringcolor (default) or pattern
opacitynumberPattern opacity 0..1 (default 1)
pattern_idstringPattern preset id; defaults to the active pattern when contents=pattern

export_artifact Export: Artifact

Export the active document and keep the file in the editor as a retrievable artifact instead of starting a browser download. format "png" is the flattened visible composite (or, with layer_id, that layer's own pixels at its content bounds); "psd" is the layered Photoshop interchange file from File > Save; "pfd" is PhotoFresco's native editable document from Save to My Documents. Returns { artifact_id, format, mime_type, filename, byte_length, sha256, document_id, revision, width, height, layer_id, fidelity, loss, created_at, expires_at }; read the bytes with artifact.read. Artifacts are bound…

ParameterTypeDescription
format *stringpng (flattened or one layer), psd (layered interchange) or pfd (native, full fidelity)
layer_idstringPNG only: export this layer's own pixels instead of the composite

filter_apply Filter: Apply

Apply a destructive filter to the active layer (selection restricts it). Types: gaussian-blur {radius px}, sharpen {amount 0..3, radius px}, sharpen-more, sharpen-edges, unsharp-mask {amount percent 1..500, radius px, threshold 0..255}, noise {amount 0..1}, box-blur {radius px}, motion-blur {angle deg, distance px}, radial-blur {amount 1..100, method spin|zoom}, average, median {radius 1..8}, mosaic {cellSize px}, high-pass {radius px}, ripple {amount px, wavelength px}, twirl {angle deg}, spherize {amount -100..100}, wave {amplitude px, wavelength px}, zigzag {amount px, ridges}, polar-coordi…

ParameterTypeDescription
filter_type *stringWhich filter
paramsobjectType-specific parameters

history_redo History: Redo

Redo the next edit. Returns the label of what was redone, or null. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: history.redo.

history_undo History: Undo

Undo the last edit. Returns the label of what was undone, or null. Reverts the last History entry, including edits made by the user. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: history.undo.

image_resize Image: Resize

Resample the whole document to new pixel dimensions (bilinear). Undoable. Inputs: width (required), height (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: image.resize.

ParameterTypeDescription
height *numberNew height px
width *numberNew width px

image_rotate Image: Rotate

Rotate the whole canvas by quarter turns: 1 = 90° clockwise, 2 = 180°, 3 = 90° counter-clockwise. Undoable. Inputs: turns (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: image.rotate.

ParameterTypeDescription
turns *number1, 2, or 3 quarter turns

layer_add Layer: Add

Add a new empty layer above the active node and make it active. Inputs: name. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.add.

ParameterTypeDescription
namestringLayer name (default "Layer N")

layer_delete Layer: Delete

Delete the active node. Refused if it would leave no layers. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.delete.

layer_duplicate Layer: Duplicate

Duplicate the active node (deep for groups); the copy becomes active. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.duplicate.

layer_set_active Layer: Set active

Set the active node (layers paint/transform; groups move as a unit). Inputs: id (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Changes editor view or tool settings; not a document edit and not in History. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.set_active.

ParameterTypeDescription
id *stringNode id from doc.get_state

layer_set_props Layer: Set props

Set properties on a node (default: the active one). Only provided fields change. blend_mode "pass-through" is groups-only. Inputs: id, name, visible, opacity, blend_mode, locked, lock_pixels, lock_position, lock_transparency, clipped, blend_if, channel_mask, knockout, blend_interior_as_group, blend_clipped_as_group, transparency_shapes_layer, mask_hides_effects, vector_mask_hides_effects. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: h…

ParameterTypeDescription
blend_clipped_as_groupbooleanApply the clipping base blend/opacity to the whole clip unit
blend_ifobject | nullRaster layer Blend If {channel,thisLayer:[b0,b1,w1,w0],underlying:[...]}; null clears it
blend_interior_as_groupbooleanBlend fill and interior effects as one source
blend_modestringBlend mode
channel_maskobjectRaster layer RGB write mask {r:boolean,g:boolean,b:boolean}
clippedbooleanClipping mask: confine rendering to the alpha of the layer below (⌥⌘G)
idstringTarget node id (default: active)
knockoutstringKnockout depth
lock_pixelsbooleanRaster layer pixel lock
lock_positionbooleanRaster layer position lock
lock_transparencybooleanRaster layer transparency lock
lockedbooleanLock/unlock
mask_hides_effectsbooleanApply the raster layer mask to generated effect output
namestringRename
opacitynumber0..1
transparency_shapes_layerbooleanUse source transparency to shape fill and interior effects
vector_mask_hides_effectsbooleanApply the vector mask to generated effect output
visiblebooleanShow/hide

mask_add Mask: Add

Add a raster mask to the active layer. mode "selection" rasterizes the current selection (selected = visible); default is "selection" when one exists, else "reveal". Inputs: mode. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFre…

ParameterTypeDescription
modestringMask contents

mask_remove Mask: Remove

Delete the active layer’s mask (the layer becomes fully visible again). Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: mask.remove.

render_mask Preview: Mask

Preview a mask over a document-space region as a grayscale PNG (black 0 = hidden/unselected, white 255 = shown/selected) with exact coverage statistics { pixels, nonzero, full, mean } computed at document resolution over the region. source "layer" (default) is a layer's raster mask (layer_id, default the active layer), placed at its document position; source "selection" is the current selection. Read-only. Returns image { mime_type: "image/png", data_base64, width, height, byte_length } plus document_id, revision (the document revision rendered), document { width, height }, requested and regio…

ParameterTypeDescription
heightnumberRegion height in document pixels (whole number; default: to the bottom canvas edge)
layer_idstringLayer whose raster mask to show (source layer; default the active layer)
max_sizenumberFit the preview inside this many pixels per side, never magnifying (default 1024). Use scale instead for exact detail
scalenumberExact output pixels per document pixel (1 = actual pixels, 4 = 4× magnified with nearest sampling, 0.25 = area-averaged). Output is limited to 2048 px per side and 4194304 px
sourcestringlayer: the raster mask of layer_id (default); selection: the active selection
widthnumberRegion width in document pixels (whole number; default: to the right canvas edge)
xnumberLeft edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas
ynumberTop edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas

render_preview Preview: Preview

Render the whole flattened composite to a PNG data URL, downscaled to fit max_size (never magnified). Use after edits to see the result. For a region at detail scale, one layer, a mask, or coordinate metadata use render.region / render.mask. Inputs: max_size. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry docu…

ParameterTypeDescription
max_sizenumberMax width/height in px (default 512, at most 2048)

render_region Preview: Region

Preview a document-space region at a chosen scale as a PNG, without rendering the whole document. Without layer_id it shows the flattened visible composite (same compositor as PNG export); with layer_id it shows that layer's own pixels (raster, text, shape or smart object) before its mask, opacity, blend mode and effects. Use scale 1–16 to inspect detail at actual or magnified pixels, or max_size to fit an overview. Read-only; nothing is added to history. Returns image { mime_type: "image/png", data_base64, width, height, byte_length } plus document_id, revision (the document revision render…

ParameterTypeDescription
heightnumberRegion height in document pixels (whole number; default: to the bottom canvas edge)
layer_idstringOptional layer id (doc.get_state) to preview that layer alone instead of the composite
max_sizenumberFit the preview inside this many pixels per side, never magnifying (default 1024). Use scale instead for exact detail
scalenumberExact output pixels per document pixel (1 = actual pixels, 4 = 4× magnified with nearest sampling, 0.25 = area-averaged). Output is limited to 2048 px per side and 4194304 px
widthnumberRegion width in document pixels (whole number; default: to the right canvas edge)
xnumberLeft edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas
ynumberTop edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas

selection_all Selection: All

Select the whole document. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.all.

selection_ellipse Selection: Ellipse

Select an ellipse inscribed in the given rect (doc coordinates). Inputs: x (required), y (required), w (required), h (required), mode, feather. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.ellipse.

ParameterTypeDescription
h *numberHeight
w *numberWidth
x *numberLeft
y *numberTop
feathernumberFeather radius in px (softens the edge)
modestringHow to combine with the existing selection

selection_invert Selection: Invert

Invert the current selection. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.invert.

selection_none Selection: None

Deselect — clear the selection so edits affect the whole canvas again. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.none.

selection_rect Selection: Rect

Select a rectangle in doc coordinates. Inputs: x (required), y (required), w (required), h (required), mode, feather. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.rect.

ParameterTypeDescription
h *numberHeight
w *numberWidth
x *numberLeft
y *numberTop
feathernumberFeather radius in px (softens the edge)
modestringHow to combine with the existing selection