Skip to main content
Glama

gimp_get_histogram

Read-onlyIdempotent

Computes per-channel histogram and statistics (mean, median, percentiles) from a GIMP image render to check exposure and clipping before export.

Instructions

Headless GIMP: statistics for several channels from ONE render: mean, median, 1st/5th/95th/99th percentiles, and a 256-bin histogram per channel (bins[v] = pixel count at value v, 0-255). luminance uses babl's D50 perceptual weights. Default is fast (~0.3s, the 1024px proxy render) — good for iterating, but small clipped highlights can be under-counted; pass exact: true (~4s on 24MP) as the final clipping check before gimp_export.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "image": "<image>"
    },
    "name": "gimp_get_histogram"
  }
}

Input Schema

NameRequiredDescriptionDefault
maskNoThe name of a selection channel: measure only the pixels it selects at 50% or more (a hard cut, no partial credit for soft edges), e.g. the mean lightness or color of a selected object. Combines with region and exact; pixels in the result is the number of pixels counted.
exactNofalse (default): computed on the 1024px proxy render (~0.3s) — good for iterating, but small clipped highlights can be under-counted. true: full-resolution composite (~4s on 24MP) — the trustworthy final clipping check before export. On a very large document true can take much longer; a call that runs past its time limit keeps running and the next call waits for it; ask again then for the reading.
imageYesImage id, as returned by gimp_open_document.
regionNoA rectangle in document pixels: {x, y, width, height}. Must lie entirely within the image — a region partly or fully outside it is refused rather than silently clamped. Computed on the proxy when it maps to a big-enough proxy area, else auto-falls back to a full-resolution crop; exact:true always forces the full-resolution crop.
channelsNoDefault: all four (luminance, red, green, blue) in ONE render.

Output Schema

NameRequiredDescriptionDefault
exactNo
widthNo
heightNo
pixelsNo
channelsNoKeyed by channel name (luminance, red, green, blue).
unmirrored_filtersNoNames of live filters GIMP refused to re-attach on this proxy render — absent from these stats entirely. Present whenever histogram actually used the (mirrored) preview proxy: the default whole-image path, OR a `region` large enough to be sampled from the proxy rather than falling back to a full-resolution crop. Absent when exact: true, or when a region is too small and falls back to that full-resolution crop — neither path mirrors filters at all.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.11.1

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent, but the description adds substantive behavioral context beyond them: approximate wall-clock costs (~0.3s vs ~4s on 24MP), the accuracy limitation of the proxy path, and the correctness stakes for clipping detection. That is exactly the kind of trade-off an agent needs to choose a mode responsibly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the resource and output list, then the mode trade-off with a concrete cost estimate. Parentheticals carry real information rather than filler; nothing is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description need not explain return structure, and it covers cost, accuracy, and the pipeline position well. Minor gaps remain around behavior on failure (e.g. an unknown mask name, or region rejection), which are left to the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents `mask`, `exact`, `region`, and `channels` in detail; the description largely restates the proxy/exact trade-off. It adds one genuinely new fact — `luminance` uses babl's D50 perceptual weights — but says nothing about `mask` or `region` semantics beyond the schema. Baseline 3 applies given full schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific operation (per-channel statistics from a single render) and enumerates the exact outputs: mean, median, 1st/5th/95th/99th percentiles, and a 256-bin histogram with `bins[v]` semantics. It differentiates itself from siblings by positioning itself as the measurement step before `gimp_export`.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly frames usage: default proxy mode is for iterating, `exact: true` is the final clipping check before `gimp_export`, and it explains why (small clipped highlights under-counted on the proxy). It gives clear conditions for each mode, though it does not explicitly say when to prefer a different sibling tool (e.g. `gimp_get_preview`) over this one.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.