Auto Painter Scripts for Corel Painter

- Controlling the Speed of Auto Clone and Auto Playback

The following tutorial, associated scripts and custom script icons are copyright of David Gell.

In Corel Painter, we have several options to automatically paint on the canvas or layer. In Painter IX, the automated rendering of the brush strokes/dabs fall into five categories;

1. Auto Clone.

Normally initiated by selecting Effects menu> Esoterica> Auto Clone, or using the Command/Control + Shift + z keyboard short-cut. As the name suggests, when selected from the Esoterica sub menu in combination with some (not all) cloning or clone colour variants, colour information from the clone source is incorporated in the randomly generated brush strokes/dabs. In Painter IX, you cannot use a non-cloning/clone colour variant in conjunction with the Effects>Esoterica menu> Auto Clone command, only via the Command/Control + Shift + z short-cut.

2. Auto Dab.

The term 'Auto Dab' will probably not be referenced in the official Painter documentation, but I use this to essentially describe Auto Clone, with or without the use of a clone variant or the clone colour option being selected in the colours palette. In my opinion, the term Auto Dab more accurately describes the process, as it can encompass the use of both cloning and non-cloning variants (it is only the source of the stroke colour information which is different, and dabs are being applied automatically in both cases). Scripting aside, auto dabbing with non-cloning/non-clone colour variants can only be undertaken via the above keyboard short-cut. As with the Auto Clone menu option, not all variants will work with the Auto Dab (Auto Clone) short-cut.

3. Auto Playback.

Auto Playback differs by the fact that the 'path' made by a brushstroke is initially recorded by first selecting the Record Stroke option from the Brush Selector Bar menu (Painter IX) and making an uninterrupted brush stroke on the canvas or layer. Selecting the Auto Playback option from the same menu will enable the recorded stroke to be automatically played back on the canvas or layer, again in randomly located dabs. This affords a much more varied brush stroke, and both cloning/clone color and non-cloning variants may be used.

4. Auto Van Gogh.

In Painter IX, and in conjunction with the Auto Van Gogh variant which is located in the default Painter Brushes library>Artists category, the Auto Van Gogh option is selected from the Effects menu>Esoterica sub menu. In this process, the rendered dabs have pre-determined orientation, which is calculated based on the original image, resulting in a Van Goghian appearance.

5. Auto Watercolor.

This is a hybrid cloning technique which I have developed by experimentation.

The Problem.

The speed of automated dab/stroke rendering may be governed by processor speed, brush/variant type, size and other brush settings, document size, and other applications which may be running in the background. Unfortunately (with the exception of Auto Van Gogh and Auto Watercolor, which actually benefit from fast processor speed), as processor speed has increased, it has meant that using the remaining 'Auto' methods has become very difficult from a control point of view. The problem is that individual dabs are applied very quickly, and so stopping the process before the number density of strokes cover the whole canvas has become difficult or impossible. Using the Undo command simply clears every stroke applied in the last automated process, so an all or nothing situation arises.

A Solution (see also A_Playback Scripts).

Using Painter's powerful scripting feature, I have developed a set of scripts which use a simple pulse technique to effectively slow down the speed of automated dab/brushstroke application. The down side is that when used in conjunction with the scripts, due to the way the scripts work, Painter's undo facility will be of very limited use. You will still be able to use the current maximum of 32 levels of undo, however, when I tell you that the total dabs applied running just a single 'Auto' script to completion will required the full 32 undo operations to clear, then you will quickly learn to commence with a new document/layer, which can be readily disposed of, should the need arise.

The scripts are contained within a script library, and the individual scripts are executed (ran) via a user created custom palette. The Painter IX 'Auto Painter' custom palette layout which I currently have is shown below;

The above custom palette, in combination with the scripts allows for the following options (at least these are the results I obtain in the Mac version of Painter IX (9.1).

1. Three speeds of Auto Dab (Auto Clone); slow, medium and fast (depicted by the top three icons in the palette).

2. As above for Auto Playback (depicted by the three icons in the middle row).

3. A dedicated stop button is shown bottom right of the palette (single clicking in the document image no longer works to stop the 'Auto' stroke rendering).

4. All 'Auto' scripts can be exported as text files, edited to increase or decrease the time interval between dab pulses and/or the number of dabs applied with each pulse.

5. It is not necessary to stop each script via the Scripts palette Stop button before playing another, as the speed of dab deposition will alter by simply clicking on a different speed script icon in the custom palette, part way through playback of the current script.

6. It is possible to change colour, opacity, select a new layer (via the Layers palette New Layer icon), change brush category, variant and many other variables during playback of any of the 'Auto' scripts. I would recommend having the Auto Dab Slow or Auto Playback Slow script running in this case, to give you more time to make the changes before the respective script ends.

7. If a brush stroke is recorded initially, then it is possible to switch directly from Auto Playback Fast to say Auto Dab (Auto Clone) Slow, and back again, even in mid stream of the first script playing. The appearance of the brush stokes produced by the two (Auto Dab/Clone and Auto Playback) methods should be quite different. Test this out in conjunction with an Image Hose variant too.

Note that the Record Stroke, Playback Stroke and Save Stoke command buttons are assigned to the custom palette via Window menu>Custom Palette>Add Command dialogue (Painter IX). Please refer to your Painter help files for further information on creating custom palettes.

As the name suggests, the Record Stroke button in the custom palette is the one you would press immediately prior to making your initial canvas brushstroke for playback. The Playback Stroke button is clicked if you wish to manually playback your recorded stroke on the canvas or layer. In this case, the stroke will be centred on wherever you click in the document on a one stroke per click basis. Click this button again to turn off the option. The Save Stroke button allows the artist to save the 'path' of the recorded brush stoke for later use. This is saved with a unique name and can be subsequently accessed from the Brush Selector Bar menu>Strokes sub menu (Painter IX). Painter's Built in Auto Playback button is to be found in the Brush Selector Bar menu (Painter IX). If you have never used this option before, it may be interesting to compare rendering speed with the scripted versions; the same with Auto Clone.

Tip

You may find it easier to use a mouse in conjunction with running the scripts from the Auto Painter custom palette. It is probably best to initially use a tablet stylus to record your brushstoke prior to Auto Playback.

Undo Warning!

When I auto playback a recorded stroke using Painter's built in Auto Playback function, every stroke in the previous playback sequence is undone with a single undo. Similarly, the strokes applied after initiating either Effects>Esoterica>Auto Clone or the associated keyboard short-cut one time, are undone with a single undo. Unfortunately, this is not the case with the slow, medium and fast Auto Dab/ Auto Playback scripts. Undoing all of the brush stokes applied by a single click of these latter scripts requires the full 32 levels of undo being previously assigned in your Painter preferences. I therefore strongly recommend taking the appropriate precautions before using the fast, medium and slow Auto Dab/Auto Playback scripts in order to protect any previously applied artwork. This may include doing a Save or Save As immediately prior to using the scripts in question and/or working on a new layer or document, which can be deleted if required. Failure to do this may result in loss or degradation of previous artwork to the level of the last save.

Disclaimer.

The Auto_Painter script libraries have been compiled by me, David Gell using Painter IX (Mac). David Gell does not accept responsibility for the performance of your computer, software or loss of any kind whilst downloading or using these scripts. In downloading the scripts, you have read and understood the above undo warning paragraph, which is also included in the ReadMe.

Download and Related Links.

Note: Although built and tested in Painter IX, it is possible that these scripts may function in some earlier Painter versions. Download and use at your own risk, and please do not redistribute these resources.

Auto Painter Resources for Corel Painter PC;

A_Painter_PC.zip (69.6 KB)

Auto Painter Resources for Corel Painter Mac;

A_Painter_Mac.dmg (80.4 KB)

A_Painter_Mac.sit (61.9 KB)

Important information regarding custom Script Library location in Painter IX.

Important information regarding Custom Palettes in Painter IX.

Technical Notes.

Armed with the knowledge that I could use Painter's scripting language to Auto Dab/Auto Playback fixed numbers of strokes, it seemed logical that to slow the dab application rate down, what was needed was a single script comprising of a repetition of fixed number Auto Dab/Auto Playback instructions, with a 'busy doing something else' instruction between each stroke deposition pulse, something like this;

auto_playback 5
auto_playback 1
undo
auto_playback 5
auto_playback 1
undo
auto_playback 5
auto_playback 1
undo

In the above Auto Playback script example, initially five strokes are played back, then one single stroke, followed by a single undo. As the undo only acts on the 'auto_playback 1' instruction, then the above total combination would mean that fifteen strokes remained on the canvas. The effective playback process had been slowed down by virtue of the processor having to playback the single strokes and undo them again. Voila! it worked, but the flicker of the single strokes appearing and disappearing was a little distracting (could be useful for an animation sequence though). Below is a graphical representation of the end result;

Note that in the above graph, there would be an accumulative total of 10 brushstokes applied to the canvas/layer with the second pulse, 15 with the third and so on.

Only two things were now needed to meet my requirements. The first was to find a substitute for the auto_playback 1 step, that would slow down the rate of brushstroke rendering, but would not be visible on the canvas. This was solved by substituting a sharpen command, which had the sharpen amount edited to zero. The second requirement was to produce a set of three scripts which would give slow, medium and fast auto playback speeds. Logically, this would depend on the number of non-rendering tasks that Painter had to complete between each rendering instruction. The number of strokes applied with each instruction could also be edited, in order to build up density (quantity) of brushstrokes more quickly or slowly. Individual processor speeds could also be matched by editing the scripts to give more or fewer 'in between' tasks.

One problem I did have initially was that I could not stop the scripted auto playback/auto clone process by clicking in the document image. This was solved by creating a dedicated stop script (which works for both the Auto Dab and Auto Playback scripts), and adding this to the custom palette. In most cases, a single click on the Stop icon is all that is required, but occasionally a double click may be necessary.

The Auto Dab/Auto Playback Slow and Medium scripts currently yield 32 pulses in multiples of 5 strokes per pulse. This gives a total of 160 individual strokes per single script play (assuming the script is not stopped during playback).

In the case of the Auto Dab/Auto Playback Fast scripts, there are a total of 32 pulses in multiples of 10 strokes per pulse. This yields a total of 320 strokes per single script play.

For the purpose of editing, the Auto Dab/Auto Playback Slow, Medium and Fast scripts may return an error message if opened directly via the Scripts palette edit menu. To avoid this, first select the script in the Scripts palette Open Script menu dialogue and choose the Export option. Edit the script in a suitable text editor which does not line wrap (I use BBEdit on the Mac), save the now edited text file, and then choose the Import script option from the above Scripts palette menu dialogue.

The following lines should be edited in a suitable text editor for the Auto Dab/ Auto Playback Slow, Medium and Fast scripts (I used BBEdit's find and replace function to good effect);

auto_playback 5 ('auto_clone 5' for the Auto Dab Slow and Medium scripts).

There should be 32 of the above lines per respective script (for a maximum of 32 levels of undo). Change the number at the end (5 in this case) to alter the number of playback strokes per sequence. Note that in the above case, 5 individual strokes would also be removed with one undo.

image_processor operation 1 aperture_type 0 amount 0.00000 highlight 1.00000 shadow 1.00000 sharpen_red 1 sharpen_green 1 sharpen_blue 1
undo

These functions should be on two separate lines (with the undo command being on it's own line immediately below the 'sharpen' image_processor operation). This latter combination of instructions is used in between the auto_playback/ auto_clone commands to slow down the rate of playback by keeping the processor busy. This two line combination is repeated in succession, to give the desired interval delay between individual auto_playback commands.

When importing a script (via Scripts palette menu> Open Script> Import), the script icon will initially be blank. The icon will only be added (based on the currently open document) at the end of the first play of the script via the script palette play button (second from left at bottom of Scripts palette). As the image appears to be sampled after script playback, and the scripts performs an image altering function, I found it necessary to set the current brush opacity to zero, prior to playing the imported script for the first time.

Remember, this is not an exact science, and factors such as processor speed, brush type and settings, stroke size and complexity, document size, other open applications etc. may all effect the speed of Auto Dab (Auto Clone)/Auto Playback to a lesser or greater degree.