GIMP Studio MCP
v0.4.0Enables AI assistants to edit images in GIMP 3, with tools for print and DTF transfer production.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
status
GIMP/bridge health: GIMP version, bridge version, mode, open-image count, and the names seeded into the persistent namespace. `warnings` reports a bridge in GIMP older than this package expects, and any timeout setting that is not a usable number of seconds.
list_images
List open images: id, name (basename), width, height, dirty flag.
set_active_image
Set the active image by integer id or basename string. Tools that take `image` act on the active image when it is omitted: the image last chosen here, opened or created, while it stays open; otherwise GIMP's first open image. A checkpoint copy is never the active image.
| Parameter | Type | Description |
|---|---|---|
image * |
gimp_exec
Raw escape hatch: run Python inside GIMP. Returns the structured envelope {ok, result, stdout, warnings, error}; stdout is preserved even on error. Set a top-level `_result` for structured output. The persistent namespace has Gimp/Gegl/Gio/GLib/GObject/Babl, `pdb`, `find_image(spec)`, and `compat` (color/read_pixel/color_to_alpha/...). Runs arbitrary host code by design (same trust boundary as the local user); set GIMP_MCP_NO_EXEC=1 to skip registering this tool. See SECURITY.md.
| Parameter | Type | Description |
|---|---|---|
code * | string | |
undo_group | boolean |
reset_namespace
Reset the persistent namespace. scope='soft' (default): clear user-defined vars and re-seed the baseline; the canvas/open images are untouched. scope='scratch' (guarded HARD reset): soft + delete only bridge-created scratch images (checkpoint snapshots tagged in `_gimpmcp_scratch`); never touches user-opened or agent working images.
| Parameter | Type | Description |
|---|---|---|
scope | string |
get_metadata
Metadata for an OPEN image: pixel width/height, resolution [x_dpi, y_dpi], base type, precision, file path, dirty flag, and per-layer info (size, opacity, visible, has_alpha). `image` = id/basename, or omit for the active image. To inspect a file ON DISK (e.g. verify an export's pixels / DPI), open_image it first, then call this on the returned id.
| Parameter | Type | Description |
|---|---|---|
image |
new_image
Create a new RGBA image. fill: white|transparent|background|foreground. Returns the new image id + size.
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
width * | integer | |
fill | string | |
name | string |
open_image
Open an image file (any format GIMP loads). Returns new image id + size.
| Parameter | Type | Description |
|---|---|---|
path * | string |
export_image
Export an image to a file (format by extension: png/jpg/tiff/webp/...). Works on a COPY — the source image is never modified. ALPHA-SAFE: transparency is PRESERVED by default for formats that support it (png/tiff/webp/tga/gif) and only flattened for formats that can't hold alpha (jpg/bmp) — so a transparent cutout isn't silently ruined. `flatten=True` forces a flattened opaque export; `flatten=False` forces keep-alpha (merge visible, no flatten). For DTF PNGs prefer `export_dtf_png` (also tags DPI). Returns {saved, format, flattened,…
| Parameter | Type | Description |
|---|---|---|
path * | string | |
flatten | ||
image |
create_layer
Create a new transparent RGBA layer (default sized to the image) and insert it at `position` (0=top) under optional `parent` group.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
height | ||
image | ||
opacity | number | |
parent | ||
position | integer | |
width |
layer_from_file
Load an image file as a new layer in the image and insert it (top by default). Optional `name`/`parent`/`position`.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
image | ||
name | ||
parent | ||
position | integer |
duplicate_layer
Duplicate a layer; the copy is inserted just above the original. `layer` = id/name, or omit for the active layer.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
name |
delete_layer
Remove a layer from the image. `layer` = id/name, or omit for active.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer |
reorder_layer
Move a layer to absolute `position` (0=top) within its parent, or into a different `parent` group when given.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
parent | ||
position | integer |
set_opacity
Set a layer's opacity (0-100 float).
| Parameter | Type | Description |
|---|---|---|
opacity * | number | |
image | ||
layer |
set_blend_mode
Set a layer's blend mode (NORMAL, MULTIPLY, SCREEN, OVERLAY, ...). Case/sep insensitive; unknown names fall back to NORMAL.
| Parameter | Type | Description |
|---|---|---|
mode * | string | |
image | ||
layer |
set_visible
Show/hide a layer.
| Parameter | Type | Description |
|---|---|---|
visible * | boolean | |
image | ||
layer |
rename_layer
Rename a layer.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
image | ||
layer |
merge_down
Merge a layer down into the one below it (EXPAND_AS_NECESSARY). Destructive. Returns the resulting merged layer.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer |
flatten
Flatten the image to a single layer. Destructive.
| Parameter | Type | Description |
|---|---|---|
image |
group_create
Create an empty layer group, inserted at `position` (0=top) under optional `parent`.
| Parameter | Type | Description |
|---|---|---|
image | ||
name | ||
parent | ||
position | integer |
group_add
Move an existing layer into a layer group at `position` (0=top).
| Parameter | Type | Description |
|---|---|---|
group | ||
image | ||
layer | ||
position | integer |
group_ungroup
Dissolve a layer group: lift its children to the group's parent (in order) and remove the empty group. Destructive to the group structure.
| Parameter | Type | Description |
|---|---|---|
group | ||
image |
move_layer
Move a layer to absolute canvas offsets (x, y).
| Parameter | Type | Description |
|---|---|---|
x * | integer | |
y * | integer | |
image | ||
layer |
offset_layer
Offset a layer by a relative delta (dx, dy) from its current position.
| Parameter | Type | Description |
|---|---|---|
dx | integer | |
dy | integer | |
image | ||
layer |
offset_content
Roll a layer's PIXEL CONTENT by (dx, dy) — distinct from offset_layer, which repositions the layer on the canvas. wrap=True wraps edges around (use it to seam-check a tileable texture); wrap=False fills the vacated strip per fill: transparent|color (color uses the `color` name/hex, default clear).
| Parameter | Type | Description |
|---|---|---|
color | ||
dx | integer | |
dy | integer | |
fill | string | |
image | ||
layer | ||
wrap | boolean |
seam_check
Wrap-offset a layer's content by half its size so a tileable texture's seams land in the middle for inspection (pair with get_bitmap). axis: both|x|y. Destructive — undo to revert (re-running the same axis restores only when that dimension is even; for odd sizes floor(w/2) applied twice lands 1px off).
| Parameter | Type | Description |
|---|---|---|
axis | string | |
image | ||
layer |
add_mask
Add a layer mask. mask_type: white|black|alpha|alpha-transfer| selection|copy|channel. Omit `layer` for the selected/top layer. For mask_type='channel' pass `channel` (id/name) as the source, or have a channel already selected; with neither, channel masks return supported=False (GIMP 3.0.4 create_mask(CHANNEL) needs a selected channel and exposes no source-channel parameter).
| Parameter | Type | Description |
|---|---|---|
channel | ||
image | ||
layer | ||
mask_type | string |
apply_mask
Merge the layer's mask into its alpha (destructive). No-op if no mask.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer |
remove_mask
Discard the layer's mask without applying it (destructive).
| Parameter | Type | Description |
|---|---|---|
image | ||
layer |
add_alpha
Add an alpha channel to the layer if it lacks one.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer |
lock_alpha
Lock (or unlock) the layer's alpha channel against painting.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
locked | boolean |
luminance_to_alpha
Map luminance to transparency per-pixel (destructive): default makes dark pixels transparent and bright pixels opaque (white-art-on-black); invert=True makes bright pixels transparent (knock out white/highlights). Computed directly over the layer buffer (no dedicated GEGL op exists in GIMP 3.0.4).
| Parameter | Type | Description |
|---|---|---|
image | ||
invert | boolean | |
layer |
color_to_alpha
SOFT knockout: remove a color to transparency with graded alpha (destructive; gegl:color-to-alpha). color: name/#rrggbb. The colour is subtracted from every pixel that contains it, so edges and matching interior tones fade smoothly — great for feathered/anti-aliased backgrounds (e.g. a clean black knockout from #000000 at threshold ~0.15-0.20). Higher `transparency_threshold` (0-1) removes a wider band of near-target colours; `opacity_threshold` (0-1) sets where fully-opaque begins. For a CRISP, hard-edged cut (select-by-colour + delete…
| Parameter | Type | Description |
|---|---|---|
color | string | |
image | ||
layer | ||
opacity_threshold | number | |
transparency_threshold | number |
cutout_color
HARD knockout: select a colour and DELETE it to transparency — the crisp, predictable cutout (the tool form of by-hand 'add alpha -> select by colour -> delete'). Auto-adds alpha. WYSIWYG: no auto-mode, no defringe, no alpha-clean. Colour to remove: explicit `color` (name/#hex/rgb) OR a `sample_xy=[x,y]` eyedropper (one is required). `threshold` (0-1, default 0.15) = colour-match tolerance. `contiguous=True` removes only the edge-connected region (keeps interior areas that reuse the colour); seeds from `sample_xy` if given, else the ne…
| Parameter | Type | Description |
|---|---|---|
antialias | boolean | |
color | ||
contiguous | boolean | |
feather | number | |
image | ||
layer | ||
sample_xy | ||
threshold | number |
threshold_alpha
Binarize the alpha channel at `value` (0..1) for a clean print edge (destructive).
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
value | number |
select_rect
Rectangular selection. op: replace|add|subtract|intersect. Returns selection bounds.
| Parameter | Type | Description |
|---|---|---|
h * | integer | |
w * | integer | |
x * | integer | |
y * | integer | |
image | ||
op | string |
select_ellipse
Elliptical selection inscribed in the x,y,w,h box. op: replace|add|subtract|intersect.
| Parameter | Type | Description |
|---|---|---|
h * | integer | |
w * | integer | |
x * | integer | |
y * | integer | |
image | ||
op | string |
select_by_color
Select all pixels matching a color (name/#rrggbb/(r,g,b[,a])) within threshold (0..1). op: replace|add|subtract|intersect.
| Parameter | Type | Description |
|---|---|---|
color * | ||
image | ||
layer | ||
op | string | |
threshold | number |
fuzzy_select
Contiguous color (magic-wand) selection seeded at x,y within threshold (0..1). op: replace|add|subtract|intersect.
| Parameter | Type | Description |
|---|---|---|
x * | integer | |
y * | integer | |
image | ||
layer | ||
op | string | |
threshold | number |
select_all
Select the entire image canvas.
| Parameter | Type | Description |
|---|---|---|
image |
select_none
Clear the selection (select nothing).
| Parameter | Type | Description |
|---|---|---|
image |
select_invert
Invert the current selection.
| Parameter | Type | Description |
|---|---|---|
image |
select_grow
Grow the selection outward by `steps` pixels.
| Parameter | Type | Description |
|---|---|---|
steps * | integer | |
image |
select_shrink
Shrink the selection inward by `steps` pixels.
| Parameter | Type | Description |
|---|---|---|
steps * | integer | |
image |
select_feather
Feather (soften) the selection edge by `radius` pixels.
| Parameter | Type | Description |
|---|---|---|
radius * | number | |
image |
select_border
Replace the selection with a border band `radius` pixels wide.
| Parameter | Type | Description |
|---|---|---|
radius * | integer | |
image |
selection_to_channel
Save the current selection to a new channel. Returns the channel id.
| Parameter | Type | Description |
|---|---|---|
image | ||
name |
select_from_alpha
Select from a layer's alpha (opaque pixels). layer = id/name or omit for the active drawable. op: replace|add|subtract|intersect.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
op | string |
select_from_path
Select the region enclosed by a path. path = id/name or omit for the active path. op: replace|add|subtract|intersect. If the image has no paths and none is named, returns {"supported": false} (nothing to do) rather than erroring.
| Parameter | Type | Description |
|---|---|---|
image | ||
op | string | |
path |
foreground_select
Edge-aware SUBJECT selection via SIOX/matting (gimp-drawable-foreground-extract). Refines a ROUGH hint into a clean foreground selection — good for hair/soft/complex edges and backgrounds that AREN'T a flat colour (where cutout_color / select_by_color fail). It is SEMI-automatic: it needs a rough hint and does NOT auto-detect the subject. Rough hint: pass a bounding box `x, y, w, h` roughly around the subject, OR make a rough selection first and omit the box. `band` = px the hint is grown / shrunk to form the 'unknown' boundary ring th…
| Parameter | Type | Description |
|---|---|---|
band | ||
h | ||
image | ||
layer | ||
w | ||
x | ||
y |
set_fg
Set the foreground color. color = name|'#rrggbb'|(r,g,b[,a]).
| Parameter | Type | Description |
|---|---|---|
color * |
set_bg
Set the background color. color = name|'#rrggbb'|(r,g,b[,a]).
| Parameter | Type | Description |
|---|---|---|
color * |
set_brush
Set the active paint brush by name (e.g. '2. Hardness 050').
| Parameter | Type | Description |
|---|---|---|
name * | string |
set_paint_opacity
Set the paint/context opacity (0-100).
| Parameter | Type | Description |
|---|---|---|
opacity * | number |
fill
Fill the whole drawable. fill_type: foreground|background|white| transparent|pattern. `layer`/`image` optional (default active).
| Parameter | Type | Description |
|---|---|---|
fill_type | string | |
image | ||
layer |
bucket_fill
Flood-fill from seed point (x, y) with `color` (or current fg). mode = layer-mode name (e.g. 'normal', 'multiply').
| Parameter | Type | Description |
|---|---|---|
x * | number | |
y * | number | |
color | ||
image | ||
layer | ||
mode | ||
opacity |
gradient
Draw a gradient from (x1,y1) to (x2,y2). `gradient` = named gradient (else fg->bg). gradient_type: linear|bilinear|radial|conical-symmetric|...
| Parameter | Type | Description |
|---|---|---|
x1 * | number | |
x2 * | number | |
y1 * | number | |
y2 * | number | |
gradient | ||
gradient_type | string | |
image | ||
layer |
stroke_selection
Stroke the active selection's outline with `color`/`line_width` (current fg/line width if omitted).
| Parameter | Type | Description |
|---|---|---|
color | ||
image | ||
layer | ||
line_width |
pencil
Hard-edged pencil stroke. points = flat [x1,y1,x2,y2,...]. Uses `color` or current fg.
| Parameter | Type | Description |
|---|---|---|
points * | array | |
color | ||
image | ||
layer |
paintbrush
Soft paintbrush stroke. points = flat [x1,y1,x2,y2,...]. Optional `brush` name + `size`; uses `color` or current fg.
| Parameter | Type | Description |
|---|---|---|
points * | array | |
brush | ||
color | ||
image | ||
layer | ||
size |
create_text_layer
Create a text layer. font=name (else context font); size in px; color by name/#hex/(r,g,b); justify=left|right|center|fill; x/y = position offsets.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
color | ||
font | ||
image | ||
justify | ||
letter_spacing | ||
line_spacing | ||
size | number | |
x | ||
y |
set_text_props
Mutate any subset of an existing text layer's properties (omitted args are left unchanged). `layer` = id/name of a text layer.
| Parameter | Type | Description |
|---|---|---|
layer * | ||
color | ||
font | ||
image | ||
justify | ||
letter_spacing | ||
line_spacing | ||
size | ||
text | ||
x | ||
y |
outline_text
Add an outline beneath a text layer: alpha->selection, grow by `radius`, fill onto a new layer in `color`. Destructive (adds a layer).
| Parameter | Type | Description |
|---|---|---|
layer * | ||
color | string | |
image | ||
radius | integer |
check_fonts
Report availability of each font name -> {name: bool}.
| Parameter | Type | Description |
|---|---|---|
fonts * | array |
substitute_font
Best-effort font-substitution report: whether `old` is missing and `new` is present (does not mutate global GIMP config).
| Parameter | Type | Description |
|---|---|---|
new * | string | |
old * | string |
levels
Adjust levels on a drawable. channel: value|red|green|blue|alpha. Inputs/outputs are 0.0-1.0 floats in LINEAR light, not the 0-255 sRGB values color_at reports: a pixel color_at reads as 200 sits at about 0.58 here. gamma is the midtone exponent.
| Parameter | Type | Description |
|---|---|---|
channel | string | |
gamma | number | |
high_in | number | |
high_out | number | |
image | ||
layer | ||
low_in | number | |
low_out | number |
curves
Apply a spline curve. `points` = flat [x0,y0,x1,y1,...] control points in 0.0-1.0, in LINEAR light like levels (not the sRGB values color_at reports). channel: value|red|green|blue|alpha.
| Parameter | Type | Description |
|---|---|---|
points * | array | |
channel | string | |
image | ||
layer |
brightness_contrast
Adjust brightness and contrast. Each ranges -1.0..1.0 (0 = no change).
| Parameter | Type | Description |
|---|---|---|
brightness | number | |
contrast | number | |
image | ||
layer |
hue_saturation
Adjust hue/lightness/saturation. range: all|red|yellow|green|cyan|blue| magenta. hue -180..180, lightness/saturation -100..100, overlap 0..100.
| Parameter | Type | Description |
|---|---|---|
hue | number | |
image | ||
layer | ||
lightness | number | |
overlap | number | |
range | string | |
saturation | number |
color_balance
Shift color balance for a tonal range: shadows|midtones|highlights. Each channel pair is -100..100; preserve_lum keeps luminosity.
| Parameter | Type | Description |
|---|---|---|
cyan_red | number | |
image | ||
layer | ||
magenta_green | number | |
preserve_lum | boolean | |
range | string | |
yellow_blue | number |
desaturate
Convert to grayscale values in place. mode: luminance|luma|lightness| average|value.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
mode | string |
invert
Invert colors. linear=True inverts in linear light, else perceptual.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
linear | boolean |
posterize
Reduce each channel to `levels` discrete tones (2..255).
| Parameter | Type | Description |
|---|---|---|
levels * | integer | |
image | ||
layer |
threshold
Black/white threshold: pixels in [low, high] -> white, else black. low/high are 0.0-1.0 on the same sRGB scale as color_at (divide its 0-255 values by 255). channel: value|red|green|blue|alpha.
| Parameter | Type | Description |
|---|---|---|
channel | string | |
high | number | |
image | ||
layer | ||
low | number |
normalize
Auto-stretch tones to fill the full 0-255 range (like Colors > Auto > Stretch Contrast). keep_colors=False (default) stretches each channel independently — maximum contrast, but may shift colour balance; keep_colors=True stretches all channels uniformly to preserve hue (gegl:stretch-contrast).
| Parameter | Type | Description |
|---|---|---|
image | ||
keep_colors | boolean | |
layer |
apply_filter
Apply any GEGL operation to a layer (destructive merge). `op` = full op name e.g. 'gegl:pixelize'. `params` = {property: value} (underscores become hyphens; color-like values auto-coerced).
| Parameter | Type | Description |
|---|---|---|
op * | string | |
image | ||
layer | ||
params |
gaussian_blur
Gaussian blur a layer (gegl:gaussian-blur). std_dev_x/y in pixels.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
std_dev_x | number | |
std_dev_y | number |
unsharp_mask
Sharpen a layer via unsharp mask (gegl:unsharp-mask). std_dev = blur radius, scale = sharpen strength.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
scale | number | |
std_dev | number |
drop_shadow
Add a drop shadow to a layer (gegl:dropshadow). x/y = offset, blur = shadow radius, grow = shadow expansion, color = name/'#rrggbb'/(r,g,b). NOTE: gegl:dropshadow ENLARGES the target layer and shifts its offsets so the soft shadow has room to render (verified on GIMP 3.0.4: a 64x48 layer at (0,0) became 116x100 at (-20,-20)). The layer may therefore extend beyond the canvas; flatten or crop afterward if you need it clipped.
| Parameter | Type | Description |
|---|---|---|
blur | number | |
color | string | |
grow | number | |
image | ||
layer | ||
opacity | number | |
x | number | |
y | number |
print_geometry
Set print resolution (dpi) and/or scale to a physical size in inches. Pass width_in and/or height_in to scale (aspect preserved if one given). Reports current inches @ dpi and warns on upscaling.
| Parameter | Type | Description |
|---|---|---|
dpi | ||
height_in | ||
image | ||
width_in |
trim_to_content
Autocrop the image to the artwork's alpha bounding box, plus optional padding (px). Removes empty transparent margins.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
padding | integer |
white_underbase
Core DTF op: create a white-ink layer BELOW the art, filled to the art's alpha shrunk inward by `choke` px at `opacity`. Returns new layer id.
| Parameter | Type | Description |
|---|---|---|
choke | integer | |
image | ||
layer | ||
opacity | number |
edge_choke
Pull the art's effective alpha edge inward by `pixels` (trims a thin rim — useful before underbase or to remove fringing).
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
pixels | integer |
edge_spread
Grow (dilate) the art's alpha edge outward by `pixels`, fattening the artwork and carrying the edge colour into the grown ring (morphological alpha dilate via gegl:median-blur).
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
pixels | integer |
knockout_background
One-click DTF background / shirt-colour knockout. Auto-adds an alpha channel if the source is flat (no need to call add_alpha first). For a dead-simple crisp cutout of ONE flat colour, prefer `cutout_color` (hard) or `color_to_alpha` (soft) — this tool adds garment-aware auto-technique + presets on top. Colour to remove, by priority: explicit `color` (name/#hex) > `shirt=` garment preset (see list_shirt_presets) > `sample_xy=[x,y]` eyedropper > AUTO-DETECT from the image edges. (A `shirt=` preset still supplies the technique +…
| Parameter | Type | Description |
|---|---|---|
clean | boolean | |
color | ||
contiguous | ||
defringe | boolean | |
feather | number | |
image | ||
layer | ||
mode | string | |
sample_xy | ||
shirt | ||
tolerance |
list_shirt_presets
List the built-in garment / shirt-colour presets for knockout_background(shirt=...) — name, display, hex, technique, tolerance.
clean_for_dtf
Binarize the ALPHA channel at `threshold` (0-1, default 0.5): pixels below it -> fully transparent (drops faint dust/noise), at/above -> fully opaque (crisp ink edges for film). RGB is untouched. NOTE: this HARDENS every soft/anti-aliased edge and drops intentional low-alpha interior detail (faint gradients / highlights) below the threshold — skip it, or lower the threshold, when the art has soft edges worth keeping.
| Parameter | Type | Description |
|---|---|---|
image | ||
layer | ||
threshold | number |
despill
Reduce edge color spill left over from a knockout (best-effort approximation; flag if results are off).
| Parameter | Type | Description |
|---|---|---|
amount | number | |
color | string | |
image | ||
layer |
halftone_separation
Apply a newsprint halftone screen. PREVIEW/APPROXIMATION ONLY — this is a visual halftone, NOT registration-accurate channel film separations.
| Parameter | Type | Description |
|---|---|---|
angle | number | |
cell_size | number | |
image | ||
layer |
gang_sheet
Lay out multiple design files on a print sheet via a left-to-right / top-to-bottom shelf packer (gutter between items), growing height as needed, then export a transparent PNG. A design wider than the sheet's printable width is skipped with a warning; with `rotate=True`, a design that fits when turned 90 degrees is rotated instead. If no design can be placed, nothing is saved and the call returns ok=false with each file's reason. Returns {placed, skipped, sheet_px, out_path, image}.
| Parameter | Type | Description |
|---|---|---|
files * | array | |
out_path * | string | |
dpi | number | |
gutter_in | number | |
rotate | boolean | |
sheet_width_in | number |
bleed_and_safe
Add a bleed margin (resize canvas by bleed_in on each side) and report the inner safe-area rect (inset by safe_in).
| Parameter | Type | Description |
|---|---|---|
bleed_in | number | |
image | ||
safe_in | number |
export_dtf_png
Export a transparent, print-ready PNG. PRESERVES ALPHA — merges visible layers WITHOUT flattening (flattening would drop alpha and ruin the DTF transfer). DPI: if `dpi` is given the file is tagged at it; if OMITTED the file inherits the image's CURRENT resolution (e.g. whatever `print_geometry` set). This only writes the DPI tag — it never resamples pixels, so set the physical print size with `print_geometry` FIRST, then export. Works on a duplicate (source untouched); returns the saved path and the DPI tag written.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
dpi | ||
image |
get_profile
Read the image's embedded ICC profile label (None = built-in sRGB). `image` = id/basename, or omit for the active image.
| Parameter | Type | Description |
|---|---|---|
image |
assign_profile
Tag the image with an ICC profile WITHOUT converting pixels (assign). `icc_path` = path to a .icc/.icm file. RGB/working-space use.
| Parameter | Type | Description |
|---|---|---|
icc_path * | string | |
image |
convert_profile
Convert pixels into the target ICC working space (RGB/working-space only). intent: perceptual|relative-colorimetric|saturation|absolute-colorimetric. bpc = black-point compensation.
| Parameter | Type | Description |
|---|---|---|
icc_path * | string | |
bpc | boolean | |
image | ||
intent | string |
soft_proof
NOT SUPPORTED: soft-proofing is a VIEW-only display simulation in GIMP 3.x, not a scriptable pixel operation — this ALWAYS fails. Returns ok=false with {supported: false, note}; no pixels are changed. Use convert_profile to bake the conversion instead.
| Parameter | Type | Description |
|---|---|---|
icc_path | ||
image | ||
intent | string |
to_grayscale
Convert the image to GRAYSCALE mode (destructive).
| Parameter | Type | Description |
|---|---|---|
image |
to_rgb
Convert the image to RGB mode (destructive).
| Parameter | Type | Description |
|---|---|---|
image |
list_profiles
NOT SUPPORTED: the libgimp API cannot enumerate installed ICC profiles — this ALWAYS fails. Returns ok=false with {supported: false, note}. Pass explicit .icc paths instead; get_profile reads an image's own profile.
get_bitmap
THE vision tool: render a scaled/cropped/composited COPY and return it as a VIEWABLE image (an MCP image block you can actually see) plus size metadata. region=[x,y,w,h] crops first; background (name/hex) flattens over an opaque colour (else alpha is kept); the longest side is scaled to <= max_dim (clamped 1..4096). If the encoded image would exceed max_bytes (~4 MB default) it is auto-downscaled to fit your context. Pass save_to=<abs path> to write the render to disk and get the path back instead of an inline image — use this for previ…
| Parameter | Type | Description |
|---|---|---|
background | ||
fmt | string | |
image | ||
max_bytes | integer | |
max_dim | integer | |
region | ||
save_to |
read_region
Structured 2D grid of [r,g,b,a] pixels for a rectangle. Capped at w*h<=4096 (raises if larger — use get_bitmap for big areas).
| Parameter | Type | Description |
|---|---|---|
h * | integer | |
w * | integer | |
x * | integer | |
y * | integer | |
image | ||
layer |
color_at
Sample one pixel: returns {rgba:[r,g,b,a]} (0-255).
| Parameter | Type | Description |
|---|---|---|
x * | integer | |
y * | integer | |
image | ||
layer |
histogram
Channel statistics (value|red|green|blue|alpha|luminance). space='perceptual' (default) computes the stats from the drawable's own pixels in the same 0-255 sRGB values as color_at/get_bitmap, returning mean, std_dev, median, min, max (all 0-255) plus pixels/count. space='gimp' returns GIMP's native PDB histogram (mean/std_dev/median/percentile, no min/max). Very large drawables are point-sampled at reduced resolution (min/max are from the sample, flagged by `sampled`).
| Parameter | Type | Description |
|---|---|---|
channel | string | |
image | ||
layer | ||
space | string |
list_gegl_ops
List available GEGL operation names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
describe_op
Introspect a GEGL op: categories, description, and its properties.
| Parameter | Type | Description |
|---|---|---|
op * | string |
list_procedures
List PDB procedure names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
list_fonts
List installed font names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
list_brushes
List brush names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
list_patterns
List pattern names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
list_gradients
List gradient names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
list_palettes
List palette names, optionally filtered by substring.
| Parameter | Type | Description |
|---|---|---|
filter |
checkpoint
Snapshot an image (a real duplicate) so you can restore() it later. Returns a numeric checkpoint_id. `image` = id/basename, or omit for active.
| Parameter | Type | Description |
|---|---|---|
image | ||
label |
restore
Roll an image back to a checkpoint by rebuilding its layer stack from the snapshot. The checkpoint stays usable. `image` = which image to restore into.
| Parameter | Type | Description |
|---|---|---|
checkpoint_id * | integer | |
image |
list_checkpoints
List live checkpoints: id, snapshot image_id, and whether it's still valid.
undo_group_begin
Begin an undo group on an image: subsequent edits collapse into one undo step. Pair with undo_group_end. `image` = id/basename, or omit for active.
| Parameter | Type | Description |
|---|---|---|
image |
undo_group_end
End the undo group started by undo_group_begin on this image.
| Parameter | Type | Description |
|---|---|---|
image |
undo
Undo the last operation — only if GIMP exposes scriptable undo, which GIMP 3.x does NOT (undo is interactive), so this returns ok=false with {supported: false} and rolls nothing back. Use checkpoint()/restore().
| Parameter | Type | Description |
|---|---|---|
image |
redo
Redo the last undone operation — only if GIMP exposes scriptable redo, which GIMP 3.x does NOT, so this returns ok=false with {supported: false} and redoes nothing. Use checkpoint()/restore() for reliable rollback.
| Parameter | Type | Description |
|---|---|---|
image |