DynamicPaintbrush


A Paintbrush for PixInsight. [more]

Categories:DeepSkyColors, Painting

Keywords: paint, painting, brush, paintbrush, masks.

Contents

[hide]

1 Introduction

[hide]

Welcome to DynamicPaintbrush!

DynamicPaintbrush is a dynamic process that allows us to define a custom brush and use it to paint over any view (opened image) in PixInsight.

Since directly painting over an astroimage is not typically needed, the DynamicPaintbrush tool was designed to paint on images that we'd be using as masks. For that reason, this implementation only paints in black, white and any level of opacity. We can also define the brush size and softness - from 100% hard edges to nice and smooth, blurry brushes.

2 Setup and Installation

[hide]

If you’re reading this, it means you successfully installed DynamicPaintbrush and are now reading the inline documentation. Excellent!

As you know, the official distribution of DynamicPaintbrush is only available via PixInsight itself, which will fetch it directly and safely from our PixInsight repository at https://repo.deepskycolors.com/DynamicPaintbrush/. Make sure the trailing / is part of the URL. Be sure to keep our repository URL in your list of PixInsight repositories to receive timely updates.

Our PixInsight repository is the only official DynamicPaintbrush source, and it comes with the guarantee of our Developer and Repository certificates, verified by PixInsight itself from the moment it connects to our repository until it completes installation of the DynamicPaintbrush 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.

3 Launching DynamicPaintbrush

[hide]

Launching DynamicPaintbrush —

DynamicPaintbrush is accesible via PROCESS > Painting and PROCESS > DeepSkyColors menu.

DynamicPaintbrush is under the Painting and DeepSkyColors categories, so we can navigate to either category using PixInsight's PROCESS menu or the Process Explorer.

DynamicPaintbrush is a dynamic process, much like DynamicCrop or DBE.

Dynamic here means that the process needs to interact with an image as we use the process. For a painting tool, this makes a lot of sense. Clearly, we can't define where we want to paint without an image! (okay, we could, but let's not go there!)

Therefore, the first thing we do after launching the DynamicPaintbrush tool is to click anywhere on the view we want to paint. Until then, all controls in the DynamicPaintbrush window will be disabled, with the message "No view selected" being displayed.

Activating the dynamic interface —

A circled cursor means we're ready to paint.

The moment we click on a view, such view is locked with the DynamicPaintbrush tool (the "dynamic" interface between the tool and the view), the controls in the DynamicPaintbrush window become enabled, and our mouse cursor becomes a small circle around the cross-hair when we hover over our selected view. That circle, by the way, shows us the current brush size.

We're ready to paint.

4 Painting with DynamicPaintbrush

[hide]

Painting is as easy as clicking on our selected view and dragging the mouse around as we please. We can click and drag (or just click if we want to draw a dot/circle) as many times as we need.

DynamicPaintbrush was designed to work on non-linear images. Using it on linear images may not produce good results, unless we use very low opacity values (See the "Usage Hints" section below for more details on this).

Painting on an image —

We can use DynamicPaintbrush for more than just masks.

If we've used the CloneStamp tool, the interface probably looks very familiar. Indeed, the DynamicPaintbrush tool works exactly the same as the CloneStamp tool (without the cloning, of course), offering similar brush property parameters and a history of "strokes" that we can navigate back and forth (undo/redo/etc).

Indeed, as we do new strokes, we'll notice that we start to build a "history" or sequence of this painting session, one stroke at a time.

Navigating painting history —

We can undo/redo our strokes with the navigation toolbar.

Now, remember that DynamicPaintbrush is a dynamic process. This is not GIMP or Photoshop. Therefore, it's very important that we remember the following:

Although we can see the results of our painting in real time, nothing is actually applied to our image until we execute the process, by clicking on the green check-mark.

If, instead of executing our painting session, we decide to cancel the whole thing, we would instead click on the red X (the one next to the green check-mark) and our entire painting sequence would be dismissed.

5 Parameters

[hide]

We can adjust the brush size, softness and opacity, as well as whether we want to paint in black or white color.


Size:

This is the brush radius size in pixels. The current version allows values from 1 to 255 pixels.
For those needing precise measurements, the actual values may sometimes be rounded up/down by a pixel or so.

Softness:

This parameter defines how "soft" the edges of the brush would be.

A value of 0.00 means the edges won't be soft at all, literally only painting on the image values of 1 (brightest possible pixel value) or 0 (unless we also adjust the opacity, defined next). This behavior is actually forced in the tool, as a softness value of 0.01 already defines a noticeably softer brush.

A value of 1.00 on the contrary defines very soft, Gaussian brush edges. Values between 0.00 and 1.00 control the amount of "blur" we're adding to the brush.

Opacity:

We adjust this parameter to increase or decrease the transparency or opacity of the brush. Technically, the brush values are multiplied by this parameter prior to being applied.

A value of 1.00 means we're applying full force on the brush - this is how DynamicPaintbrush is typically used. A value of 0.01 (the minimum allowed value) results in almost imperceptible strokes.

Brush Color:

On the right area of the dialog box we can see a small brush image that changes as we adjust the previous three parameters. We can click on the image to change the color of the brush, from white to black, or from black to white.

Navigation bar:

The navigation bar under the brush icon should be self-explanatory.

When we click on the red X button, the current stroke in our paintbrush history is deleted, while all other strokes are preserved.

The other four buttons are to Undo all, Undo, Redo and Redo All our position in the DynamicPaintbrush history.

Info/Help icon: 

Under the navigation bar we can see a small "info" icon. We can click on it to obtain information about the module's version, registration, help links and copyright information.

6 Usage Hints & Known Issues

[hide]

Painting on linear images
As mentioned earlier, DynamicPaintbrush was designed to work on non-linear images.

This is because when we paint, the tool typically uses a brush that utilizes the entire [0,1] range of pixel values, so it's way too bright for astronomical linear images. We can try to make it work on linear images by reducing considerably the brush's opacity. However, since DynamicPaintbrush is mostly useful for working on masks, we rarely need to worry about using the tool directly on linear images.

Just to be clear, using DynamicPaintbrush to paint on an image that is being applied as a mask to a linear image is perfectly fine (see the next two paragraphs). The "final" image may be linear but the mask -which is where we're painting- is not, and that's probably how we want it.

Painting on a mask
If we're painting on a view that has been set as a mask for another view, every stroke we make is reflected on the masked image immediately after finishing the stroke - no need to wait until we execute the process to preview how our painting would affect the masking. This can be very useful.

Painting on a masked image
When we paint on a view that has a mask applied to it, our strokes will respect the mask, as long as the mask is enabled. If we disable the mask before executing our painting sequence, DynamicPaintbrush will respect that and display any painted areas that were previously hidden by the mask.

The important thing to remember is that our results when we execute the DynamicPaintbrush process will depend on whether we have a mask applied or not at the time we execute the process, regardless of whether the mask was applied when we painted the strokes.

Known issue using the history toolbar
Version 1.1 fixes the very slow response when doing Undo/Redo on a session that uses very large brushes or it has very large strokes in a single sequence. In version 1.0, under those curcumstances, Undo/Redo was very slow. Now DynamicPaintbrush uses a snapshot-based Undo/Redo system that performs much faster.

Known issue using the opacity
The current implementation of DynamicPaintbrush uses a different painting method depending on whether we're painting at full opacity or not.

When we're at full opacity (opacity value of 1.00), DynamicPaintbrush uses a method that should feel familiar to paintbrush tools in other applications.

When not painting at full opacity (opacity value of 0.99 or less), in addition to adjusting for the opacity level, the brush works and feels slightly differently. It would take a while to explain the how and why, but in short, the brush handles self-overlapping differently as we drag it.

This behavior should change to the more familiar approach in a future version.