Interactive lasso-based mask generation for PixInsight. [more]
Categories:DeepSkyColors, MaskGeneration
Keywords: lasso, mask, selection, freehand, rectangle, ellipse, polygon, magic wand, region, feather, contract, expand, invert, tolerance, dynamic live preview.
[hide]
[hide]
Welcome to DynamicLasso, a PixInsight process module for building grayscale masks by drawing regions directly on an image. Instead of relying on pixel value ranges or star detection, we trace the areas we want by hand — freehand, as a rectangle, an ellipse, a polygon, or by using the magic wand — and DynamicLasso turns those regions into a standard mask image we can apply to any view.
Each region we draw is a discrete, editable step. We can keep adding regions, subtract from what we have, soften the edges with feathering, grow or shrink the selection with contract/expand, and invert the whole result. Because every action is recorded in a history, we can undo and redo freely, and the complete selection is serialized into the process instance, so it can be saved, dragged to a process icon, and re-applied later.
DynamicLasso is especially useful whenever a mask is easier to point at than to describe mathematically: isolating a galaxy or nebula, protecting a foreground, masking stars or a specific structure, or quickly carving out an arbitrary area for local adjustments.
[hide]
The only official distribution of DynamicLasso is via a PixInsight repository, which will fetch the module directly and safely from our PixInsight repository at:
https://repo.deepskycolors.com/DynamicLasso/
Make sure the trailing / is part of the URL. Also, be sure to keep our repository URL in your list of PixInsight repositories to receive timely updates.
By distributing DynamicLasso only via our PixInsight repository, installation comes with the guarantee of our Developer and Repository certificates, verified by PixInsight itself from the moment it connects to our repository, until it validates and completes installation of the DynamicLasso module.
If we ever want to be sure that we have the latest version available to us, we go to PixInsigh’s RESOURCES menu, select Updates,
then Manage Repositories to make sure our repository is still there, then RESOURCES > Updates > Check for Updates.
DynamicLasso is a dynamic process, so it operates on whichever view we point it at first, and then we work with DynamicLasso to define our mask, rather than adjusting parameters on the process dialog first, and then selecting the target when we're ready to apply the process.
To launch it:
While in dynamic mode the cursor changes over a valid target view, and the overlay (the regions we draw) is rendered live on top of the image.
DynamicLasso runs on a trial-then-registered licensing model. During the trial period, the tool is fully functional with no feature restrictions. When the trial expires, DynamicLasso will display a notice at startup and will not open until a valid registration key is entered (see 3.8 Registration and licensing). No internet connection is needed: keys are validated offline.
[hide]
The DynamicLasso panel is organized top to bottom into: a tool toolbar (which also holds the history controls and the region counter at its right end), a Mask adjustments group containing the Feather, Contract/Expand, and Magic Wand (Tolerance) controls, and the classic PixInsight interface bar at the very bottom. The rest of the interaction happens directly on the image, where we draw and see the live overlay.
The toolbar at the top of the panel holds the drawing and mask-operation tools, plus the history controls at its right end.
Drawing-mode buttons (mutually exclusive — we pick one):
Mask-operation buttons:
And one independent edit toggle, set apart from the drawing and mask-operation buttons:
Note on Add vs. Subtract. By default each new region is added to the mask. To subtract a region instead (cut a bite out of the existing mask wherever it overlaps), we hold Alt while drawing. The subtract applies globally to the accumulated mask, not just to the most recent region.
The Feather control sets a soft-edge radius (a Gaussian sigma, in pixels) that is applied to new regions as we create them. A feather of 0 produces a hard-edged mask; larger values produce progressively softer transitions at the region borders.
Feathering is stored per region: each region remembers the feather value it was drawn with, so regions with different softness can coexist in the same mask. As we move through the history (see History bar), the slider updates to show the feather of the current region, so we always see the value that region was drawn with.
To change the feather of a region we have already drawn, we navigate the history to that region, set the slider to the new value, and click the small Apply (checkmark) button at the end of the Feather row. The button lights up whenever the slider differs from the current region's stored value, signalling a pending change; clicking it re-feathers that region in place. This is not a separate history step. Undoing the region removes the feather change along with it. (Invert steps carry no feather, so the Apply button is unavailable on them.) When we import an existing instance, the slider snaps to the feather value of the most recently added region.
The Contract/Expand control resizes a region by a number of pixels before feathering is applied:
Just like Feather, Contract/Expand is stored per region and works the same way: the value applies to new regions as we draw them, the slider tracks the current region as we travel the history, and an Apply (checkmark) button at the end of the row commits a new value to a region we have already drawn (it lights up while a change is pending). The reset button next to it returns the displayed amount to 0. Handy as a quick way to clear the value before drawing the next region, or before Applying 0 to the current one. This is ideal for tightening a selection just inside an object’s boundary, or growing it to safely cover a structure plus a margin.
These two controls govern the Magic Wand tool and are active only while the wand is the selected drawing mode:
The wand grows a contiguous area. It spreads outward from the click point through connected matching pixels and stops at borders that exceed the tolerance, so it does not select matching pixels elsewhere in the image. Each wand selection is recorded as an ordinary region, so it participates in Add/Subtract, Feather, Contract/Expand, Invert, and the history exactly like a drawn shape.
The History buttons —
We can jump to any state in our history, then edit its feather and contract/expand settings, or delete the entire region from the sequence, leaving all other actions untouched.
The right end of the toolbar holds a set of history controls with a region counter beneath them. Every action — each added region, each subtract, and each invert — is one step we can move through:
The information label reports the current state (for example, the number of regions). Keyboard shortcuts work while the cursor is over the image (dynamic mode):
| Ctrl+Z | Undo |
| Ctrl+Shift+Z | Undo All |
| Ctrl+Y | Redo |
| Ctrl+Shift+Y | Redo All |
| Delete | Delete |
The toolbar's Dynamic Live Preview (DLP) button opens the Dynamic Preview, a real-time preview window shared across all Deep Sky Colors modules. It is our own live-preview engine replacement for PixInsight's built-in Real-Time Preview, rebuilt from the ground up to be far more capable. Where the native RTP is a single fixed panel that can only show one rendition of the result, the Dynamic Preview is a true, freely resizable window that can show the image, the mask, or the mask laid over the image, and adds its own zoom, pan, pixel readout, screen-stretch toggle, a pixel grid, render-quality control and one-click extraction to a new image. Everything updates live as we work.
For DynamicLasso, the Dynamic Preview shows the target image together with the mask we are building, refreshed after every stroke, undo/redo, invert, feather or contract/expand change. It renders the actual final mask, with feathered edges, contract/expand morphology and inversion all included, so it is exact, not the fast visual approximation drawn as the on-image overlay. It opens in Overlay mode by default, the image with the masked-out areas tinted red, so we immediately see how the mask will protect the image.
The Dynamic Preview window —
The Dynamic Preview can show in real time the mask being created (top left), the mask being applied (top right), and more. We can also zoom in/out with great precission, activate a pixel grid, and pan around the image. The buttons left to the Quality setting let us switch what is shown and how, all updating live as we refine the selection.
Three buttons choose what the preview shows (one active at a time):
If we select one mode, then another, and at that point we continue clicking on button for the selected mode, that will flip between the current view mode and the previous mode we selected: much more useful than having to click a different button every time when we want quick back-and-forth view flips.
Beside them, an independent Invert toggle shows the mask inverted in the preview only. It flips what the preview displays (and which pixels the red overlay covers) without touching the actual selection, which is handy for checking the complementary region without adding a real Invert step to the mask.
The rest of the toolbar is what we expect from a capable viewer:
The Dynamic Preview is a normal floating window: we resize it, move it, and leave it open wherever it is convenient while we keep working on the image. Click the DLP button again, or close the window, to dismiss it; clicking once more brings it back where we left it.
The Move / Rotate button on the toolbar (to the right of the Magic Wand) is an edit toggle rather than a drawing tool. While it is active, drawing is suspended and an oriented bounding box with handles is shown around the current region (the most recent one in the history).
The cursor shows what a drag will do: a four-way arrow over the body (move), a rotate cursor over a corner, and a double-headed arrow over a side handle (resize). To transform an earlier region, step back through the history until it becomes the current region, then grab its box. Both added and subtracted regions can be moved and rotated; Invert steps (which carry no geometry) and Magic-Wand fills (whose shape is tied to the image pixels they were grown from) cannot, so the gizmo is not shown for them.
A move, rotation or resize is applied to the current region in place: it is part of that region rather than a separate history step, and it is saved with the instance, so a repositioned, rotated or resized region survives Execute, save-to-icon and reload. Navigating the history (undo / redo / delete, by button or keyboard) automatically leaves Move/Rotate mode.
The Preferences button (the wrench icon on the process interface bar) opens the DynamicLasso license information dialog. This dialog reports the current license state:
When the module is not yet licensed, the dialog shows a “Click here to register” link. Clicking it opens the registration dialog, where we enter our email and license key. The fields are validated as we type, and the Register button enables only once a valid email/key pair is entered. After a successful registration the info dialog refreshes in place to the “licensed to” state, no need to reopen it.
[hide]
A typical mask-building workflow:
Launch DynamicLasso and move the cursor over the target image. The first stroke locks that view as the target.
Choose a drawing mode (Freehand, Rectangle, Ellipse, Polygon, or Magic Wand) from the toolbar. For the Magic Wand, set the Tolerance and metric first (see Magic Wand options).
Set a Feather value if we want soft edges. (We can change feather between regions; each region keeps its own value.)
Draw our first region. It is added to the mask and appears in the overlay.
Add more regions as needed. Hold Alt while drawing to subtract a region (cut a hole) instead of adding. (In Polygon mode, hold Alt on the first click; in Magic Wand mode, hold Alt as you click.)
Use Contract/Expand to tighten or grow the selection, and Invert to flip it if we want to mask everything except what we drew.
Reposition, rotate or resize any region with the Move / Rotate toggle (see Moving, rotating and resizing regions): drag the box to move it, a corner to rotate it, a side handle to resize it.
Turn on Dynamic Live preview at any point to open the Dynamic Preview and see the exact rendered mask over the image (Overlay), the mask on its own, or the image alone, including soft edges and morphology.
Use the history controls (or Ctrl+Z / Ctrl+Y) to step back and forth as we refine the selection.
When satisfied, Execute the process (apply it to the view). DynamicLasso generates a grayscale mask image. If Apply mask is enabled, the mask is assigned to the target image and the target window is brought to front; otherwise the mask is produced as its own image window for us to use as we like.
How the mask is built (overview). Regions are processed in the order they were drawn. Added regions are filled and unioned into the mask; subtracted regions remove their overlap from the accumulated mask globally; invert steps complement the whole mask. Both feathering (a Gaussian blur of the region’s coverage) and contract/expand (which resizes coverage before that blur) are applied per region, using the value each region was drawn with. The result is a standard single-channel grayscale image suitable for use anywhere PixInsight accepts a mask.
[hide]
Keep the Dynamic Preview on while fine-tuning feather and contract/expand: the on-image overlay is an approximation, but the Dynamic Preview shows the true rendered edges.
Use Overlay mode to judge the protection, Mask only to inspect the mask itself. Overlay (the default) tints the masked-out pixels red right over the image, so we see exactly what the mask will guard; the Invert toggle previews the complementary region without changing the selection.
Build complex selections incrementally. Many small added regions plus a few Alt-drag subtracts are often faster and more controllable than one perfect freehand trace.
Use Rectangle/Ellipse with Shift for clean squares and circles when masking regular structures or framing.
Reach for the Polygon tool for straight edges. When a boundary is better described by a few straight segments than by a shaky freehand trace, click the corners. And remember that Backspace can undo the last vertex before closing.
Let the Magic Wand do the tracing when a region is defined by tone or color (a bright core, a uniform background). Start with a low Tolerance and raise it until the selection just covers what we want; switch the metric to RGB when color, not brightness, separates the area from its surroundings.
Set Feather and Contract/Expand before drawing each region. Because these attributes are stored per region, we can mix crisp and soft regions in one mask, e.g., a hard core plus a soft halo.
Reach for Contract/Expand instead of redrawing. If a freehand trace is close but slightly too tight or too loose, we nudge the whole selection in or out with one control.
Move, rotate or resize instead of redrawing. If a region is in the right shape but the wrong place, angle or size, turn on Move / Rotate and drag its box (move), a corner (rotate), or a side handle (resize). No need to trace it again. Step back in the history first to grab an earlier region.
Fix a region's feather or contract/expand after the fact. We don't have to get softness or size right the first time. Step back through the history to the region, change the slider, and click its Apply (checkmark) button. The slider always shows the current region's own values as we travel the history.
Invert is reversible and free. Draw the easier shape (often the object) and invert when we actually want to protect it. Click Invert again to flip back.
Use the keyboard while drawing: Ctrl+Z / Ctrl+Y (and the Shift variants for all-the-way) let us experiment without leaving the image.
Save our work as a process icon. Because the full set of regions and actions is serialized into the instance, we can drag the instance to a process icon and re-apply or tweak the exact same selection later.
Copyright © 2026 Deep Sky Colors. All Rights Reserved.