At a glance
- Dodge, Burn and Sponge tools in one interface
- Brush size, hardness and flow controls
- Shadows, midtones and highlights range for Dodge and Burn
- Protect Tones option that preserves hue and saturation
- Sponge saturate or desaturate with an optional vibrance mode
- Stroke-by-stroke undo and redo
- Original/Preview comparison toggle
- Faster Preview mode for large images
- Navigator mini-map, Ctrl+wheel brush resizing
- Create Copy or Apply to Target output
- Current version
- 1.0
- Menu
- Script › MK Scripts › Local Brush Tools
- Installed from
https://mhkastro.github.io/MKScripts/- Author
- Mohammed Khalifa
The script window
(opens a larger version) Installation
https://mhkastro.github.io/MKScripts/ - Open Manage Repositories. In PixInsight, choose Resources → Updates → Manage Repositories.
- Add the MKScripts repository. Click Add, paste the repository URL into the box and confirm.
- Check for updates. Choose Resources → Updates → Check for Updates and select the MKScripts packages you want.
- Exit PixInsight to install. The update is installed when you exit PixInsight, which then restarts automatically.
Full instructions: Installing MKScripts in PixInsight.
What the tool does#
MK Local Brush Tools lets you paint local adjustments with a brush:
- Dodge raises brightness locally, within a chosen tonal range.
- Burn lowers brightness locally, within a chosen tonal range.
- Sponge adds or removes color saturation locally while keeping lightness.
All painting happens on a hidden working copy. The source image is not changed while you paint. When you are done, choose one of two outputs:
- Create Copy opens the result in a new image window.
- Apply to Target writes the result to the original image as a normal PixInsight operation. You can undo it in PixInsight's history.
When to use it#
Use it for hand-guided, local corrections that would otherwise need a custom mask: brightening a faint region, darkening a distracting area, or adjusting saturation in one part of the image.
Requirements and input preparation#
- PixInsight 1.9.4 or a later 1.9.x version.
- At least one open image. Otherwise the script stops with the message "Please open at least one image before running Local Brush Tools."
- Color images for Sponge. Dodge and Burn work on color and grayscale images. Sponge needs a color image and shows a warning on grayscale images.
- Screen space. The dialog requests a minimum size of 1400 × 780 pixels and is resizable.
- Display. The preview shows the image data as it is, without an automatic stretch. These tools are easiest to use on stretched (non-linear) images.
Installation and launch#
- Install MKScripts from the repository: in PixInsight choose Resources → Updates → Manage Repositories → Add, paste
https://mhkastro.github.io/MKScripts/, then run Resources → Updates → Check for Updates. Full steps: Installing MKScripts in PixInsight. - Open the image you want to edit.
- Choose Script › MK Scripts › Local Brush Tools.
Basic workflow#
- Choose the image in Target Image. The status bar shows its size and number of channels.
- Choose a tool in Tool: Dodge, Burn or Sponge. A short description appears below it.
- Set up the brush: Brush Size (in image pixels), Hardness and Flow.
- Set the tool options.
- Dodge or Burn: choose a Range (Shadows, Midtones or Highlights), an Exposure, and whether to Protect Tones.
- Sponge: choose a Mode (Saturate or Desaturate), an Aggressiveness, and whether to use Vibrance.
- Paint by dragging with the left mouse button in Working Preview. Repeated passes build up the effect.
- Compare with the Original button, which switches between the untouched original and your edited preview.
- Correct mistakes with Undo Stroke and Redo Stroke. Each complete stroke is one step.
- Finish with Create Copy (new image) or Apply to Target (asks for confirmation, then writes to the original).
Controls#
Tool Selection#
| Control | Default | What it does |
|---|---|---|
| Target Image | First open image | The image to edit. Changing it loads a fresh working copy and clears the stroke history. |
| Tool | Dodge | Dodge, Burn or Sponge. The matching settings group is shown. |
Brush#
| Control | Range | Default | What it does |
|---|---|---|---|
| Brush Size | 1–512 px | 80 px | Brush diameter, in pixels of the source image. Ctrl + mouse wheel over the preview changes it in 5-pixel steps. |
| Hardness | 0–100 % | 100 % | Size of the brush's full-strength core. Outside the core, the effect fades smoothly to zero at the edge. At 100 % the whole brush is full strength. |
| Flow | 1–100 % | 20 % | How quickly the effect builds up as the brush passes over an area. |
| Faster Preview | Off | — | Paints on a reduced-size copy for responsiveness (see Faster Preview). |
The preview shows the brush outline. When the hardness core is visible, it appears as a fainter inner circle.
Dodge / Burn Settings#
| Control | Range | Default | What it does |
|---|---|---|---|
| Range | Shadows, Midtones, Highlights | Midtones | Limits the adjustment to a tonal region, with smooth transitions (see below). |
| Exposure | 1–100 % | 20 % | Maximum brightness change per brush dab, before Flow and edge falloff are applied. |
| Protect Tones | — | On | On color images, adjusts lightness while preserving hue and saturation as far as possible. |
| Original / Preview | — | — | Switches the display between the untouched original and your edited result. Strokes are not affected. |
How the ranges are weighted, by pixel brightness from 0 (black) to 1 (white):
- Shadows: full effect below about 0.05, fading out by about 0.65.
- Midtones: strongest at 0.5, fading smoothly to nothing at 0 and 1.
- Highlights: starts at about 0.35 and reaches full effect at about 0.95.
For color images, brightness is measured as luminance (0.2126 R + 0.7152 G + 0.0722 B).
Sponge Settings#
| Control | Range | Default | What it does |
|---|---|---|---|
| Mode | Desaturate, Saturate | Saturate | Removes or adds color saturation. |
| Aggressiveness | 1–200 % | 10 % | Scales the strength of the Sponge effect, independently of Flow. |
| Vibrance | — | On | When saturating, the effect is stronger on less-saturated colors and stops at a lower saturation limit. When desaturating, the effect is stronger on more-saturated colors. |
| Original / Preview | — | — | Same as in Dodge / Burn Settings. |
When saturating, nearly neutral (gray) pixels are left unchanged, and saturation is capped below full saturation.
History, navigation and output#
| Control | What it does |
|---|---|
| Undo Stroke / Redo Stroke | Steps back or forward one complete stroke. |
| Reset Result | After confirmation, restores the working copy to the original image and clears the stroke history. |
| Reset Settings | Restores all tool and brush settings to their defaults. Your strokes are kept. |
| Navigator | Click or drag in the mini-map to move the preview. |
| Create Copy | Opens the result as a new image named after the target with _LocalBrush appended. The script also tries to copy the target's FITS keywords to the new image. |
| Apply to Target | After confirmation, writes the result to the target image. PixInsight records it as a normal operation, so it can be undone. |
| Close | Closes the dialog and discards the working copy. |
Mouse controls in Working Preview#
| Action | Result |
|---|---|
| Left-drag | Paint |
| Right-drag | Pan |
| Mouse wheel | Zoom, up to 1600 % |
| Ctrl + mouse wheel | Change brush size |
| Right double-click | Zoom to fit |
The status bar shows the pixel coordinates under the pointer and messages from the script.
Faster Preview#
On large images, painting at full resolution can lag. With Faster Preview on:
- You paint on a reduced copy. The scale factor is at most 0.5, and small enough that the longer side is at most 1200 pixels.
- Each brush dab's position is recorded. When you click Create Copy or Apply to Target, the strokes are replayed on the full-resolution image with the same settings.
- If you turn Faster Preview off while strokes are still pending, the script asks for confirmation. It then applies those strokes to the full-resolution working copy and clears the undo history.
The reduced preview is an approximation. Always check the full-resolution result after creating it.
Tips#
- Build effects gradually. Low Flow and Exposure with several passes give more control than one strong pass.
- Soft edges: lower the Hardness so the effect blends into its surroundings.
- Avoid color shifts when dodging or burning color images: keep Protect Tones on.
- Natural saturation boosts: keep Vibrance on when using Sponge in Saturate mode.
- Non-destructive workflow: use Create Copy to keep the original untouched. Use Apply to Target when you want the change recorded in the image's history.
- Painting switches the view back automatically. If you are viewing the original when you start a stroke, the preview returns to your edited result.
Troubleshooting and limitations#
| Symptom | Explanation and solution |
|---|---|
| The script stops with "Please open at least one image…" | Open an image first, then run the script again. |
| "The Sponge tool requires a color image." | Sponge works only on color images. Use Dodge or Burn on grayscale images. |
| Undo Stroke is greyed out | There are no strokes to undo, or the oldest strokes were dropped from history (see below). |
| "The target geometry or channel count has changed…" | The target image was resized or changed after it was loaded. Select it again in Target Image to reload it. |
| Painting lags | Turn on Faster Preview or use a smaller brush. |
| Painting outside the image does nothing | Strokes only start inside the image area. |
| Mouse wheel zooms instead of resizing the brush | Hold Ctrl while turning the wheel. |
Limitations:
- The stroke history keeps at most 10 strokes, or fewer if they changed more than about 1.5 million pixels in total. Older strokes are dropped from the history, but their effect remains in the image.
- Turning off Faster Preview with pending strokes clears the undo history.
- Reset Result affects only the working copy. It cannot undo an earlier Apply to Target; use PixInsight's history for that.
Version information#
| Item | Value |
|---|---|
| Version | 1.0 |
| Source file | MKLocalBrushToolsV1.0.js |
| Menu (feature ID) | Script › MK Scripts › Local Brush Tools |
| Installed from | MKScripts repository (https://mhkastro.github.io/MKScripts/) |
| Repository release date | 22 August 2026 |
| PixInsight versions | 1.9.4 – 1.9.x |
| Tested in PixInsight | Not yet recorded for this guide |
Release notes for each version are listed in the Releases section of this page.
Updates
New versions are delivered through the MKScripts repository: use Resources › Updates › Check for Updates in PixInsight.
License
Being publicly available does not make the scripts open source. See the terms of use.