Skip to main content
Glama

multi_scale_enhance

Enhance faint details and balance dynamic range by applying masked three-scale Local Histogram Equalization, with an optional HDRMultiscaleTransform pass.

Instructions

Masked three-scale LocalHistogramEqualization on a view, in one call, with an optional HDRMultiscaleTransform pass. The mask is the image lightness (CIE L* for colour, the image itself for mono) mapped as max((L - mask_clip_low) / (1 - mask_clip_low), 0), raised to the power 1/mask_gamma and blurred with a Gaussian of sigma mask_blur (0 = no blur). LHE then runs at the large, mid and fine radius in that order through the mask; the large and mid scales use lhe_slope_limit, the fine scale lhe_fine_slope_limit; other LHE parameters are PixInsight's defaults. Giving hdrmt_layers adds an HDRMultiscaleTransform pass through the same mask. The mask is closed afterwards. Reports a detail score before and after: the mean squared Sobel gradient of luminance (Rec.709 weights) over pixels brighter than median + 8 x 1.4826 x MAD, sampled every 8 pixels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
view_idYesView ID to enhance (modified in place)
mask_blurYesGaussian blur sigma of the mask in pixels (0 = no blur)
mask_gammaYesMask gamma: the rescaled mask is raised to the power 1/mask_gamma (1 = unchanged)
hdrmt_layersNoHDRMultiscaleTransform number of layers. Giving it runs the HDRMT pass; omitted, no HDRMT runs
mask_clip_lowYesLightness mapped to 0 in the mask; values above it are rescaled to 0-1
hdrmt_invertedNoHDRMT inverted iterations (needs hdrmt_layers; omitted = PixInsight default)
lhe_mid_amountYesMid-scale LHE amount, 0 to 1
lhe_mid_radiusYesMid-scale LHE kernel radius in pixels
lhe_fine_amountYesFine-scale LHE amount, 0 to 1
lhe_fine_radiusYesFine-scale LHE kernel radius in pixels
lhe_slope_limitYesLHE contrast slope limit of the large and mid scales
hdrmt_iterationsNoHDRMT number of iterations (needs hdrmt_layers; omitted = PixInsight default)
lhe_large_amountYesLarge-scale LHE amount, 0 to 1
lhe_large_radiusYesLarge-scale LHE kernel radius in pixels
hdrmt_to_lightnessNoHDRMT toLightness: on a colour image, apply the transform to the lightness only (needs hdrmt_layers; omitted = PixInsight default)
lhe_fine_slope_limitYesLHE contrast slope limit of the fine scale
hdrmt_median_transformNoHDRMT median transform instead of the wavelet transform (needs hdrmt_layers; omitted = PixInsight default)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and exceeds it: it gives the exact mask formula using mask_clip_low, mask_gamma and mask_blur; describes the scale order and slope-limit assignment; explains the optional HDRMT pass; discloses that the mask is closed afterwards; and even specifies the Sobel-gradient detail score calculation. This is far beyond a generic 'enhances the image.'

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?

The description is a dense, front-loaded paragraph: the core purpose is stated in the first sentence, then each subsequent sentence adds necessary algorithmic detail—mask construction, LHE scale behavior, optional HDRMT, mask closing, and the detail score. There is no filler or repetition.

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?

For a 17-parameter tool with no annotations and no output schema, this description is highly complete: it covers the algorithm, mask side effects, and the scoring behavior. The main gaps are that it does not specify the format in which the detail score is returned nor prerequisites such as the view needing to be open, but these are minor against the overall depth.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds relational value by tying mask_clip_low, mask_gamma and mask_blur into a concrete formula, assigning lhe_slope_limit to large/mid scales and lhe_fine_slope_limit to the fine scale, and clarifying that hdrmt_layers triggers the HDRMT pass. Some HDRMT-specific parameters remain schema-only, which is acceptable 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 opens with 'Masked three-scale LocalHistogramEqualization on a view, in one call, with an optional HDRMultiscaleTransform pass,' which is a specific verb-resource pairing and immediately distinguishes it from sibling tools like run_lhe and run_hdrmt by emphasizing the composite, masked, multi-scale nature.

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

Usage Guidelines3/5

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

The description implies when to use the tool—when a masked three-scale LHE with optional HDRMT is desired in a single call—but never explicitly names alternatives or exclusion criteria. The phrase 'in one call' hints at a separate-call alternative, but there is no direct routing guidance like 'for single-scale LHE use run_lhe.'

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