Updated: Sun, 2007-05-20 19:17

Painter Custom Palette Files

If you use Fractal Design/Metacreations/Procreate/Corel Painter a lot -- and you should -- you'll use lots of custom palettes. After the problems of Painter 8, versions IX and X of Painter have a highly effective custom palette system -- except for one thing: brushes on a custom palette have the icon of their Brush Category, and nothing to show what particular brush they are. Maddening.

Help is at hand! As luck would have it, the PAL file format (i.e. the files that are created when you choose to 'Export' a custom palette from the Organizer) contain an actual copy of the icon art for each item on the palette, in an easily edited format! By editing these files you can (with a bit of effort) get whatever icons you like on your custom brush palettes.

It's also possible to change various other things, and to change the icons of non-brush objects. However, papers, textures, commands and so on generally have reasonably intelligible buttons on custom palettes anyway.

This page describes the PAL file format -- this format happens to be human-readable and extremely simple, and it's easy to make a small utility to edit palette icons or import them from bitmaps. I use a .NET program that lets me paint simple numbers on the palette icons.

Difference between Painter X and Painter IX

The only difference in PAL file format between the last two versions of Painter is that in X, the file must be in Mac format (lines separated by a CR only) and in IX it was in DOS format (lines separated by a CRLF). In tru Painter fashion, if you get this wrong the file will fail to load completely with no error message.

Brush Icons

The main point of editing PAL files manually is to create different brush icons. Note, however, that if you don't feel like messing with the PAL file you still have several choices:
  • Create a new Brush Category with a custom icon for each brush you want to use.
  • Use Brush Looks instead of brushes -- when you save a new Look, Painter will let you associate a custom icon with it. This can be very effective.
If this level of control is not enough, then read on...

PAL File Format

A PAL file is a text file that consists of a header followed by zero or more Commands. These commands contain various elements which are generally shared between many types of commands -- notably, they may contain icon graphics which are what we want. There are three main types of Command:
  • Menu Commands
  • Brush Commands
  • Resource Commands
The header is exactly one line and each of the three types of Command is a fixed number of lines long.

Header

The header consists of a singe line, thus:
<card>-1,999,Palette_Name</card>
where '999' is the height of the palette and Palette_Name is the title. Palettes in Painter IX/X don't seem to have width -- perhaps this is because of the way they dock in vertical columns.

Menu Command

Menu Commands don't have, and can't have, icons -- you can try adding one to the PAL file but Painter will ignore it. An example of a Menu Command is as follows:
Corel::Painter::Commands::CCmdMenuCmd
No Icon
Scale...
Scale...
3*1*2
D8C12F5E-AFF9-4C71-BD22-638D5B51ED34
The first line is the command header -- every command starts with one. It's always the same for a given type of command.

The second line seems to tell the file parser in Painter not to look for an icon, but even if you supply an icon in the file it will still not be used.

The third line is the text that will appear on the button on the custom palette. It could be quite useful to edit this -- for instance it would hep with commands that have long names.

Line four is the tooltip text that will appear when the mouse is hovered over the button -- you can change this freely.

Line five is a record that's common in PAL files, a 'position record'. The three numbers, separated by asterisks, are:

  • X position -- 0 for the leftmost icon on the palette, 1 for the second-leftmost, and so on.
  • Y position -- 0 for the topmost icon on the palette, 1 for the second-topmost, and so on.
  • Width -- 2 for a menu command, 1 for everything else. Setting this to a different number has no effect, so you can't use it to make the button smaller or wider.

The last line is the GUID of the menu command to run. Commands in Painter are identified by GUIDs and they appear in various files, for example in custom keymap files.

Brush Commands

This is by far the most useful type of command to edit. Like the various resource commands, the icon image data is embedded in the PAL file. When the custom palette is created, the icon is taken from the brush category icon and copied into the PAL file, which results in many brushes having the same icon.

Here is an example:

Corel::Painter::Commands::CCmdSetBrush
Has Icon
3608
0
30
0
30
fcfcfc f9f9f9 f8f8f8 f7f7f7 f6f6f6 f4f4f4 f2f2f2 f1f1f1 efefef ededed

//...88 similar lines of pixel data go here...

b0b0b0 afafaf adadad aaaaaa aaaaaa a8a8a8 a7a7a7 a5a5a5 a4a4a2 a2a2a0
Oil Pastels
Oil Pastel 10
1*0*1
Painter Brushes
Oil Pastel 10
The first line, again, is the command header.

Now begins the icon record, which occupies the next 96 lines of the file. Its format is as follows:

  • The string 'Has Icon'
  • The string '3608' -- any other value will cause Painter to give up loading the file, and buttons beyond this point will vanish!
  • Four lines containing '0', '30', '0' and '30'. The number 30 presumably refers to the fact that the icons are 30x30 pixels, but again, if you enter any other number Painter will give up on the file.
  • Pixel data. This is 90 lines, each containing 10 pixels. Thus, 3 lines of the file describe 1 row of the actual icon. The pixels are described as rrggbb hex numbers (without leading zeroes, so there is no guarantee about the actual length of the lines in characters). This format should be familiar to everyone these days. I'm actually surprised Painter makes it so simple.
  • Icon records also occur in resource command records, but with some subtle differences.

    The next line after the icon record is the Painter Brush Category. If you have created your own user-defined categories their names can appear here.

    The next line is the tooltip text for the button. You can change this at will -- Painter fills it in with the brush name but you can put anything here.

    The next line is a 'position record' (see above). The last number in it is always 1 because brush commands are one slot wide.

    The next line is the name of the brush library to look in -- 'Painter Brushes' for brushes that came with Painter, or in fact for all brushes if you don't go out of your way to create a new directory.

    The last line is the actual name of the brush within that library.

    Resource Commands

    Resource commands work rather better by default -- their icon is dynamically generated by Painter at the time the button is added to the custom palette, based on what the resource in question looks like. You don't normally need to change it. It's also hard to change the tooltip text for resource commands because it's not directly included in the PAL file. Here is an example:
    Corel::Painter::Commands::CCmdSetPaper
    Has Icon
    3608
    0
    30
    0
    30
    38383838 1e1e1e1e 28282828 51515151 9e9e9e9e b3b3b3b3 75757575 38383838 1e1e1e1e 28282828
    
    //...here are 88 more rows of pixel data...
    
    47474747 19191919 5050505 f0f0f0f 2e2e2e2e 66666666 70707070 47474747 19191919 5050505
    <str t=17500 i=002>
    <str t=17500 i=002>
    0*4*1
    Painter Papers.papers
    
    The first line is the command type. There are several possibilities:
    • Corel::Painter::Commands::CCmdSetPaper
    • Corel::Painter::Commands::CCmdSetGrad
    • Corel::Painter::Commands::CCmdSetPattern
    • Corel::Painter::Commands::CCmdSetPattern
    • Corel::Painter::Commands::CCmdSetBrushLook
    • Corel::Painter::Commands::CCmdSetNozzle
    These each correspond to one selectable resource type in Painter.

    Following this, there is an icon record. For some resource types, the record has hidden surprises:

    • For Paper resources, the pixels are 8 hex digits long, with each of the 4 components (ARGB, presumably) set to the same value. The icon is thus grayscale. The A value seems to be ignored when the icon is drawn, even though it has to be in the file.
    • For Pattern resource, the pixels are again in 8-digit format but the A component is always set to ff. Changing it doesn't seem to make any difference.
    • For Look resources, the pixels are 8-bit again as for Pattern resources.
    Following the icon, there are two lines that have to be enclosed in vaguely XML-like angle brackets. These lines are 'resource selector' records. The number after 't' is the resource ID of the text string to use as a tooltip. This seems to be an OS-level resource ID (i.e. on Windows it's an ID of an entry in the PE file's resource block) so it's not exactly a friendly value. The number after the 'i' is the ID of the actual resource (paper, pattern etc) to load. This seems to be a Painter-level ID and the numbers therefore correspond to the order the resources actually appear in in the dropdown lists.

    It's unclear why there are two lines, or which one is actually used by Painter.

    The next line is a position record, as for all command types.

    The next line describes the library in which to find the resource -- it's simply a filename. Oddly, Painter does not appear to automatically load the file given here when the button is pressed. Actually, for Painter, that's not really odd -- my trial version of Painter X can't make a pattern at all anyway.

    Conclusion

    PAL files aren't exactly rocket science -- they're much simpler and less fragile than most Painter file formats, and by editing them it's possible to finally get custom palettes of brushes that look good.

    Now, if only there were some way to assign shortcut keys to those brushes! We can but dream!

    Reply

    Just type the word 'hwacha', that's all. Seriously, this fools most spambots.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.
    More information about formatting options