Grain Offset Scripts for Corel Painter
Grain Offset Scripts for Corel Painter 7 and above are a collection of macro scripts which can be used to offset the current paper texture overlay position prior to any mark being made on the canvas or layer. Currently, the only way I know to do this without using scripts is to apply texture in smaller, selective areas on individual layers and then reposition these areas using the Layer Adjuster tool. You can then erase any areas of unwanted texture to fit the region you wish to overlay.
In Painter 11 and earlier versions, the paper texture preview may be dragged around in the Paper Preview Window of the Papers palette, but unfortunately this has no effect on the texture overlay position when it is applied to the canvas or layer.
The individual scripts generally move the pre-applied paper texture by a preset number of pixels in a given direction, but a user defined script has also been included such that the Row Origin and Column Origin values for the offset can be manually edited prior to running the script. Also included is a script to reset the grain position to the default origin. The scripts can either be ran via. the Play button in the Scripts palette, or via. a custom palette in the case of the presets.
I have opted to use the terms ‘paper texture’ and ‘grain’ interchangeably, both in this article and in the script names.
Download the Grain Offset Script Library
Offset_Scripts_PC.zip (48 KB) for Corel Painter 7 and above (PC platform).
Offset_Scripts_Mac.zip (47 KB) for Corel Painted 7 and above (Mac platform).
After unzipping, the above script libraries (Grain Offset.ssd for the PC version and Grain Offset for the Mac Painter version) can be located anywhere on your hard drive. However, if you intend to run any of the scripts via. a custom palette, the install locations are specific. In this case, please follow the instructions in my article ‘Running Painter Scripts from a Custom Palette‘ in the Scripting section of this site.
To load the scripts, first launch the Scripts palette (if not already visible on the desktop) by selecting Window menu> Scripts. From the Script Selector flyout menu choose Load Library (see above screenshot), navigate to and highlight the script library file in the Choose Scripts dialog, before clicking Open.
To run a script from the Scripts palette, first select it in the Script Selector window before clicking the Play button. It is not necessary to do this if the scripts are ran via. a custom palette. In that case, simply click the associated script icon in the custom palette itself in order to play/ run the script.
Script naming convention
I have used compass points to represent the direction of grain offset provided by each script (N for North, NW for North West etc.). The numbers in the script names are the grain offset distance from the default origin position in pixels. For example, the offset for the Grain N 200 script is 200 pixels in a North direction.
Download Grain Offset Test Paper
Grain_Offset_Test_PC.zip (3 KB) for Corel Painter 7 and above (PC platform).
Grain_Offset_Test_Mac.zip (3 KB) for Corel Painter 7 and above (Mac platform).
In order to test more accurately that the scripts were working correctly, I created a paper texture comprising of a bounded cross at the centre of a 1000 pixel square tile. Note that you may have to drag in the Paper Preview Window in order to see any of the associated paper imagery in the Papers palette.
After unzipping, the above paper library (Grain Offset Test.pap for the PC version and Grain Offset Test for the Mac Painter version) can be located anywhere on your hard drive.
To load the papers library, first launch the Papers palette (if not already visible on the desktop) by selecting Window menu> Library Palettes> Papers. Choose Open Library from the Papers palette flyout menu, then navigate to and highlight the respective papers library in the Choose Papers dialog before clicking OK.
For testing purposes, create a new document in Painter 1000 x 1000 pixels at 72ppi. Select say the Square Chalk variant from the default Painter Brushes library and paint over the central region of the canvas to reveal the Grain Offset Test paper texture (as seen in the above screenshot). Now play/ run any of the Grain Offset preset scripts, painting in the area of the canvas where you expect the grain imagery to appear. Note that it can be useful to overlay the document with a grid (Canvas menu> Grid> Show Grid) to aid measurement.
Custom Palette Demonstration
I dragged some of the script icons from the Grain Offset scripts library to create a custom palette. also adding an additional command button to show/ hide the Papers palette (Window menu> Custom Palette> Add Command). In the background I have used the default Painter 11 Chalk category> Real Fat Chalk variant in combination with some of the Grain Offset scripts. I used the above Grain Offset Test paper and Small Dots paper from the default Paper Textures library.
User Defined Offset Script
The command in the scripts which performs the grain offset is called Grain Position. Incorporated in this command is an Operation instruction (which should normally be set to a value of 1 in order for grain repositioning to take place). If this value is changed to 0 then no repositioning can be performed, and a value of 2 for the Operation will reset the grain position to the default origin (no offset).
Row Origin and Column Origin values (currently set to 0 in the above screenshot) define the grain offset in pixels relative to the default origin 0,0. Where applicable, these values may also be negative in order to define the direction of offset (see graph in next section below).
Unlike the previous preset scripts, the User Defined Offset script is intended to be manually edited and ran on the fly from the open Scripts palette. In order to do this, first select the User Defined Offset script from the Script Selector Window in the Scripts palette. Next, select Open Script from the Scripts palette flyout menu and highlight the User Defined Offset script in the Open Script dialog before clicking Open.
In the Script List window, click on the triangle next to Grain Position to expand the list and double click the Row Origin and Column Origin fields in turn, to enter the required pixel offset values in the Set Number dialogue (refer to the graph in the section below to determine whether the values should be positive or negative). Click OK in the Set Number dialogue after entering the new value.
Finally, click the Play button on the bottom row of the Scripts palette to run the script. Note that the script may be left open in the Script List window if multiple offset changes are required during the painting session. Otherwise select Close Script from the Scripts palette flyout menu when done.
When editing and running this script on the fly, always make sure that the User Defined Offset script is selected so that its name appears to the top left of the Script Selector window before clicking the Play button, otherwise the wrong script will be played.
Grain Offset Graph
The above graph can be used in combination with the User Defined Offset script in order to determine whether the Row Origin and Column origin values should be positive or negative for a chosen direction of grain offset. Note that in the graph r = Row Origin and c = Column Origin, with the default (no offset) position represented by 0 in the centre of the graph.
As an example, to offset the grain four pixels directly to the right (East);
Row Origin value in the script = 0
Column Origin = 4
To offset the texture say twelve* pixels in a South West direction;
Row Origin value in the script = -12
Column Origin = 12
*Actual point-to-point offset = 17 pixels (see section below on calculating point-to-point offset).
It is important to note that the grain offset values are always relative to the default origin (Row Origin = 0 Column Origin = 0), therefore running a script which offsets four pixels to the right twice will still leave the grain position four pixels from the default origin, not eight pixels.
As the Crow Flies
As the grain offset distances are determined by x and y (column and row) pixel values, these distances from the default 0,0 origin will be correct for offsets which do not deviate from being directly horizontal or vertical from this point (the Grain N, S, E and W offset scripts for example). In the case of other offsets however, the ‘as the crow flies’ distance from a point in the default origin to the same point in the offset grain will not be the same, even if the Row Origin and Column Origin values were the same (ignoring positive and negative direction).
Fortunately, if required, there is an online Pythagorean Theorem calculator. To use this calculator, go to the linked page, and in the table named ‘Calculate hypotenuse if you know’ enter the Row Origin and Column Origin values (ignore minuses) in the Leg A and Leg B fields respectively, before clicking the Solve! button. The answer obtained will be the actual point to point offset from the default origin in pixels (round the value off to whole numbers). Note that I have adjusted the values in the applicable script presets so that for example the Grain NW 200 script will offset 200 pixels from the default origin. Without this adjustment, the point to point offset would have been 283 pixels instead of 200.