Appendix A - Miscellaneous

A.1 Shortcuts

The complete list of all keyboard and mouse shortcuts in mtPaint is part of the built-in help, called up by pressing F1 or by the 'Help->About' menu option; see the "Keyboard shortcuts" and "Mouse shortcuts" sections.

Additionally, several of the menu options have their keyboard shortcuts labelled next to the option.

Besides these, there is one optional shortcut that you may find useful: The "Q" key will quit the program, if enabled through the Interface section of the Preferences window.

You can reconfigure the shortcuts, remove existing ones or add your own, using the 'Help->Keyboard shortcuts' menu option. In the left-hand list, choose an action; in the right-hand list, choose a shortcut and press the "Remove" button; or click the "New key..." button, press the key or combo, and press "Add". If the key is already in use for something else, you'll be offered a choice to remap it or leave as is.

A.2 Supported File Types

mtPaint can handle the following file formats:

Format Load Save Image Type
BMP All. Indexed palette. 24 bit RGB including alpha channel. Any
GIF All. Indexed palette including transparency index. Animations via Gifsicle. Indexed
JPEG All. 24 bit RGB. RGB
JPEG2000 All. 24 bit RGB including alpha channel. RGB
LBM All. Indexed palette. 24 bit RGB. Including alpha channel, mask, transparency index. Any
LSS16 (*.lss) All. Indexed palette (16 colours), 18 bits per colour (6 per RGB channel). Indexed with 16 colours or less
PAM All. 2 colour indexed palette. 24 bit RGB. Including alpha channel. Any
PBM All. 2 colour indexed palette. Indexed with 2 colours
PCX All. Indexed palette. 24 bit RGB. Any
PGM All. No. Indexed with greyscale palette
PMM All. Indexed palette. 24 bit RGB. Including transparency index, alpha/​selection/​mask channels. Any
PNG All. Indexed palette. 24 bit RGB. Including transparency index, alpha/​selection/​mask channels. Any
PPM All. 24 bit RGB. RGB
SVG All. No. RGB
TGA All. Indexed palette. 24 bit RGB. Including alpha channel. Any
TIFF All. Indexed palette. 24 bit RGB. Including alpha channel. Any
WEBP All single images. 24 bit RGB including alpha channel. RGB
XBM All. 2 colour indexed palette including hotspot. Indexed with 2 colours
XPM All. Indexed palette. 24 bit RGB. Including transparency index and hotspot. Any

File types PNG, JPEG, JPEG2000, WEBP, TIFF, and GIF are handled by external libraries: libpng, libjpeg, libopenjpeg/libjasper, libwebp, libtiff, and giflib. As a result of this, the efficiency of these file operations will depend on the version, and build options, of these libraries installed on your system. For example, libtiff is unable to read certain old JPEG compressed TIFF files, and if built without certain libraries installed (liblzma for versions 4+, libzstd and libwebp for 4.0.10+) will be unable to read or save TIFF files compressed with these methods even if the libraries are installed on your system. For more information on these libraries, consult their respective websites:

libpng http://www.libpng.org/pub/png/libpng.html
libjpeg https://ijg.org/
libopenjpeg http://www.openjpeg.org/
libjasper https://www.ece.uvic.ca/~frodo/jasper/
libwebp https://developers.google.com/speed/webp/
libtiff http://www.simplesystems.org/libtiff/
giflib http://giflib.sourceforge.net/
liblzma https://tukaani.org/xz/
libzstd https://facebook.github.io/zstd/

A.2.1 PNG Files

When saving a PNG file you can use the preferences window or the save as dialog to set a compression value between 1 and 9 (0 = no compression). A value of 9 compresses the most, but with the penalty that it will take more CPU usage and time to create the file. Therefore for large images it may be sensible to use a lower value. Faster saving may be very important for certain jobs such as saving the frames of an animation. Here is a table comparing the time it takes me to save a 4096x4096 photo. As a comparison the basic BMP image format is also included:

Format Seconds to Save % of PNG 9 KB file size % of PNG 9
BMP 1 0.6 49,236 514.7
PNG 1 6 3.8 13,055 136.5
PNG 5 10 6.4 10,656 111.4
PNG 9 156 9,566

A.2.2 JPEG 2000 Files

The JPEG file format is currently the most commonly used file format for storing digital photos. However, there also exists a more modern and higher quality format called JPEG 2000 which mtPaint can use. Unfortunately this newer format has yet to be supported by all image viewers (e.g. web browsers) and editors, but it is still an excellent choice for storing images when quality is the most important factor.

There are two main benefits of JPEG 2000 files (JP2) compared to a regular JPEG file:

A.2.2.1 Lossy Image Comparison - JPEG vs JP2

In this example I have used the photo image from section 6.8.3, and then saved it as a JPEG image at level 95, and compared this to a JPEG 2000 file saved at level 6 by libjasper. The JPEG file was 15,172 bytes in size, with the JP2 file being 14,500 bytes.

Pixel by pixel analysis of the difference between the original image and the compressed files reveals the following errors:

Channel JP2 (6) JPEG (95)
Maximum Error Red 19 84
Green 12 46
Blue 21 104
Average Error Red 2.70 4.17
Green 1.86 2.54
Blue 2.63 5.15

This data can be reproduced by using the jcmp.sh script from the examples directory.

In this example, the JP2 image on the left shows far closer similarity to the original in the centre than the JPEG on the right. The JPEG wheel arch at the top is much more blurred and has completely lost its light rim.

In this example, the roof of the red car appears to be a different shade on the JPEG image at the bottom compared to the original in the centre, and the JP2 image at the top.

A.2.2.2 Lossless Image Comparison - PNG vs JP2 vs WebP

To store a photographic image losslessly it is possible to use a compressed PNG file. However, for most photos the JP2 and/or WebP formats produce smaller files by about 5-25%. As an example, here are the results for the photo image in section 6.8.3:

Format File Size (Bytes)
Uncompressed BMP 87,222
Lossless PNG (level 9) 56,297
Lossless JP2 (libjasper) 51,731
Lossless JP2 (libopenjpeg2) 54,733
Lossless WEBP (level 9) 49,820

It should be noted that the PNG file format still produces smaller files than JP2 when compressing images with fewer colours, such as pixel art, so the benefits are strictly limited to photographic images. WebP format however, does not share this flaw; even pixelart images compress notably better as WebP despite upconversion from indexed palette to RGB for the task.

A.2.3 TIFF Files

The TIFF format has enough of a variety of compression modes to warrant its own page in the Preferences window. With some of them only applicable to some of possible image types, and with different modes being optimal for different kinds of images, there are 3 separate default settings; one for RGB, another for indexed, and the third for monochrome (2 colour).

The modes and their supported image types are:

Compre​ssion 2 colour Indexed RGB Alpha Uses predictor
None Yes Yes Yes Yes No
Group 3 Yes No No No No
Group 4 Yes No No No No
PackBits Yes Yes Yes Yes No
LZW Yes Yes Yes Yes Indexed, RGB, Alpha
ZIP Yes Yes Yes Yes Indexed, RGB, Alpha
LZMA2 Yes Yes Yes Yes Indexed, RGB, Alpha
ZSTD Yes Yes Yes Yes Indexed, RGB, Alpha
JPEG No No Yes No No
WebP No No Yes Yes No

None means uncompressed; a simple bitmap in the natural order (red, green, blue, alpha), with TIFF header and footer (TIFF directory).

Group 3 (properly named "CCITT Group 3 compression") is a specialized compression algorithm designed for fax images. As such, it works only on 2 colour images, but on them it usually achieves a much better compression ratio than more general algorithms such as LZW, ZIP or LZMA2.

Group 4 ("CCITT Group 4 compression") is an improved variant of the Group 3 algorithm. Equally limited to 2 colour images, it produces even better compression.

PackBits is a type of RLE compression, which is rather poor (comparable to PCX, or RLE-encoded TGA) but is applicable to any flavour of image and supported by any libtiff build. Can save some space if an image has long runs of the same colour (being generated or hand-drawn), otherwise is useless.

LZW is the compression technique used in the GIF format. TIFF files written in this mode, still are a bit larger than equivalent GIFs.

ZIP is the method used in the PNG format. In mtPaint, ZIP-compressed TIFFs and PNGs share the compression level setting (0-9, where 0 means uncompressed). Again, as with LZW, TIFF files using this compression are a bit larger than equivalent PNGs.

LZMA2 is the compression algorithm introduced by the 7-Zip archiver, and on GNU/Linux systems currently represented by the xz compressor. Is generally more efficient than ZIP or LZW, but slower. Not supported by libtiff versions prior to 4.0.0.

ZSTD (Zstandard) is a compression algorithm developed at Facebook, and represented by the zstd compressor. On efficiency it is somewhere in between ZIP and LZMA2 (nearer to ZIP for the most part), but supposedly faster than either. Not supported by libtiff versions prior to 4.0.10.

JPEG is exactly the compression used in the file format of the same name. Again, in mtPaint JPEG-compressed TIFFs and JPEGs share the quality setting (0-100, the more the better - but larger too).

WebP also should be exactly the compression used by its namesake file format, however it is not the case with regard to its lossless mode. Despite the setting, the actual file is lossy; for that reason mtPaint does not offer this defective "lossless" mode as a separate choice. Not supported by libtiff versions prior to 4.0.10.

The "Enable predictor" setting in the Preferences window toggles the pre-compression horizontal differencing for the general compression algorithms (LZW, ZIP, LZMA2, ZSTD). The procedure is similar to the filtering used by the PNG format, but much more simplistic, with corresponding drawbacks; while the libpng encoder analyzes each row to select an appropriate filter (or no filter) for it, libtiff indifferently applies its differencing whether it is gainful or quite the opposite.

For this reason, when choosing a compression mode that supports differencing, you must apply your own brain to work around the dumb library. In general, with anything but photographic or scanned images, differencing makes the compression even worse, and disabling it is the right choice. But conversely, with a photo or a scan, enabling the predictor can easily make the compressed image about 1.5 times smaller.

A.2.3.1 Creating PDF Files

One major use for TIFF files is in creation of PDF documents, by feeding a multipage TIFF to tiff2pdf. While assembling any number of single-page TIFFs into a multipage one is easily done by tiffcp, the proper preparation of the parts is a much more delicate task.

For certain types of TIFF pages, tiff2pdf will pass them through as is; anything else, it will try to recompress, with usually disastrous results. Therefore, all the prepared pages must be saved with those compression types that do not offend tiff2pdf's fine sensibilities.

For a 2 colour image, such as a scanned text converted to monochrome, use the "Group 4" compression mode.

For a hand-drawn or generated image, use the "ZIP" compression mode (set to level 9 for best compression). Predictor must be disabled in the Preferences window, or the page will display wrong in the resulting PDF.

For a photographic (or scanned) image, use the "JPEG" compression mode (with whatever quality setting results in suitable size/quality).

A.2.4 PMM Files

PMM format is designed as universal format for exchanging raster images.

The idea is to allow mtPaint to be used with any of the niche and one-off image formats without adding support for the multitude of them in mtPaint code. Instead, a simple conversion utility could transform source image to PMM format, which mtPaint would load and edit, and afterward, PMM could be converted back to original format if desired.

For this, the format need be able to store any kind of image without limitation, and at the same time, be easy to create, parse, and process outside mtPaint. So PMM was created. PMM can store indexed or RGB images, with transparency or without, with alpha, selection, and mask channels or with none of them, single, layered, or animated.

Internally, PMM (Portable MultiMap) is a compatible extension to the PAM format (Portable Arbitrary Map) used by Netpbm toolkit. And PMM file can be processed as it is, without any conversion, by any Netpbm tools designed for PAM format, and by other tools which support PAM. Afterward, resulting PAM file can be relabeled as PMM with a trivial 'cat' command (or 'cp /b', for those who use Windows).

A.2.4.1 PMM File Structure

The layout of PAM format is documented HERE. Nearly everything in that description applies to PMM as well.

File consists of one or more images. Every image has a text header, followed by image data.

Header is like this:

  P7
  #MTPAINT#
  WIDTH 640
  HEIGHT 480
  DEPTH 6
  MAXVAL 255
  TUPLTYPE RGB_ALPHA SELECTION MASK TRANS=0
  ENDHDR

Image data are stored as simple bitmap, in natural order: top to bottom and left to right, RGB as red, green, blue. Utility channels, if any, are stored for each pixel after its image channel, in the order they appear in the TUPLTYPE field. PMM always uses 8-bit values (MAXVAL larger than 255 is considered an error), so there are DEPTH bytes per pixel.

The comment "#MTPAINT#" following the "P7" line is the signature of PMM format, distinguishing it from regular PAM image.

Where PMM extends PAM, is in interpreting TUPLTYPE beyond its first space-separated token. In PMM, there can follow utility channel names: "SELECTION" and/or "MASK"; "ALPHA", while also can stand alone, is normally tagged onto first token, for compatibility: "RGB_ALPHA" is known to PAM readers, while "RGB ALPHA" they will interpret as "RGB".

After the channels, there can be variables, in the "name=value" form. mtPaint will skip the ones not known to it, other PMM readers should do the same.

The variables defined at the moment are:

TRANS - transparent colour index
DELAY - animation delay, in 1/100ths of a second
X - X offset
Y - Y offset

First token of TUPLTYPE denotes the type of image. These types are recognized for PMM:

RGB - regular RGB image
RGB_ALPHA - the same with alpha (i.e. RGBA)
INDEXED - regular indexed image
INDEXED_ALPHA - the same with alpha
PALETTE - palette for the following image; not an image in its own right
TAGS - variables for the following image; itself not an image

Palette data are stored as a single line of RGB. A header for a 64-colour palette, with 8 bits per channel:

  P7
  #MTPAINT#
  WIDTH 64
  HEIGHT 1
  DEPTH 3
  MAXVAL 255
  TUPLTYPE PALETTE
  ENDHDR

Tags carry one character (usually a newline) of "image data", as PAM image cannot have zero size. A tags block setting animation delay of 0.1 seconds:

  P7
  #MTPAINT#
  WIDTH 1
  HEIGHT 1
  DEPTH 1
  MAXVAL 255
  TUPLTYPE TAGS DELAY=10
  ENDHDR
  

A.2.4.2 Manipulating PMM Images

With textual nature of PMM headers, simple bitmap structure of PMM data, and variety of tools provided by Netpbm toolkit, many useful things can be done entirely on the command line. Here are a few practical examples.

- Converting a raw VGA palette to a PMM palette file

File "pal.pal" is raw VGA palette: 256 colours, 6 bits per channel (768 bytes in all). First, create a PMM header for it, in file "pmmpal.txt":
  P7
  #MTPAINT#
  WIDTH 256
  HEIGHT 1
  DEPTH 3
  MAXVAL 63
  TUPLTYPE PALETTE
  ENDHDR
Don't forget a newline after "ENDHDR". (MAXVAL 63 denotes 6-bit values.)

Then, make a PMM file merging the two: cat pmmpal.txt pal.pal > pal.pmm

- Converting a raw indexed image to a PMM file

A 320x200 raw image is in file "img.raw" (64000 bytes). First, create a PMM header for it, in file "pmmraw.txt":
  P7
  #MTPAINT#
  WIDTH 320
  HEIGHT 200
  DEPTH 1
  MAXVAL 255
  TUPLTYPE INDEXED
  ENDHDR

Then, make a PMM file merging the two: cat pmmraw.txt img.raw > img.pmm

To specify a palette for it, simply merge the PMM image file with a PMM palette (like one from the previous example): cat pal.pmm img.pmm > pimg.pmm Or in a single step: cat pal.pmm pmmraw.txt img.raw > pimg.pmm

- Creating an animation out of PMM images

Files "frame00.pmm" ... "frame99.pmm" are animation frames. Animation speed will be 4 frames per second (frame delay 25/100ths of a second). First, create a PMM tags block for the delay, in file "anim4fps.pmm":
  P7
  #MTPAINT#
  WIDTH 1
  HEIGHT 1
  DEPTH 1
  MAXVAL 255
  TUPLTYPE TAGS DELAY=25
  ENDHDR
  
Note the two newlines after ENDHDR.

Now, make a PMM file merging all of these: cat anim4fps.pmm frame*.pmm > anim.pmm

If frame images are indexed, you can add a global palette, like this: cat pal.pmm anim4fps.pmm frame*.pmm > panim.pmm

- Relabeling a PAM file as PMM

File "img.pam" is a regular PAM file. To use it as part of PMM file (a frame in animation, or a layer in layered image), it must itself be recognizable as PMM. First, create a PMM identifier, in file "pmmid.txt":
  P7
  #MTPAINT#
Make sure there is no newline after final "#". Alternately, if the file has a TUPLTYPE which is not valid for PMM (or no TUPLTYPE at all), you can put a valid one after the identifier - like this:
  P7
  #MTPAINT#
  TUPLTYPE RGB
  #
Again, there should be no newline after final "#".

Now, make a PMM file merging the two: cat pmmid.txt img.pam > img.pmm

- Separating an RGBA image into RGB and alpha

File "rgba.pmm" is of type "RGB_ALPHA", and having been written by mtPaint, has a palette ("TUPLTYPE PALETTE") as first sub-image. Use Netpbm command "pampick" to extract the second sub-image (index 1), and "pamchannel" to extract channels.

First, extract RGB image channel: cat rgba.pmm | pampick 1 | pamchannel -tupletype=RGB 0 1 2 > rgb.pam

Then, extract alpha (labelling it as grayscale): cat rgba.pmm | pampick 1 | pamchannel -tupletype=GRAYSCALE 3 > alpha.pam

- Making an RGBA image from separate RGB and alpha

Files "rgb.pam" and "alpha.pam" (like ones made in previous example). Use Netpbm command "pamstack": pamstack -tupletype=RGB_ALPHA rgb.pam alpha.pam > rgba.pam

- Splitting a PMM image into constituent sub-images

File "anim.pmm" is an animation. Use Netpbm command "pamsplit": pamsplit anim.pmm part%d.pam -padname=3

This will write PAM files "part000.pam", "part001.pam", etc. They will differ from the original sub-images (whatever mix of frames, palettes, and tags they are) in not having the "#MTPAINT#" marking in header, so to reuse them as PMMs they will need relabeling (as shown in example above).

- Listing sub-images in a PMM image

File "anim.pmm". Use Netpbm command "pamfile": pamfile -allimages anim.pmm

A.2.5 LBM Files

The LBM format originates on Amiga; once ubiquitous, today it is firmly a "legacy" one.

More precisely, the "LBM" file extension is associated with two varieties of IFF-based Amiga image formats: ILBM (Interleaved Bitmap) and PBM (Planar Bitmap).

The transparency capabilities of LBM richly deserve the distinction of worst-followed standard ever. Not one single file in the set of examples available to me, that has a transparency mask, is using it for transparency; with most, it is not even anything resembling that: either outright garbage, or at best, a pixel protection mask of some kind (or some offset remains of such). For this reason, the mapping of LBM mask plane can be configured in the Preferences window (on the "LBM" tab, naturally), and its default destination is mtPaint's mask channel.

As to transparent colour, its matching the observable reality is only a tiny bit better; only a handful among hundreds of examples has one that is not obviously in error. Nothing in the files themselves is found to mark those few where colour transparency is the real deal, any different from the great majority where it is just an artifact of some broken program or other. To avoid many images looking broken due to erroneous transparent colour, the colour transparency for LBMs is disabled by default (again, go to "LBM" tab in Preferences to enable).

A.3 Grabbing Screenshots

mtPaint can be used to grab a screenshot with either 'File->New' or using 'mtpaint -s' from the command line. If you are an IceWM user you can assign the key 'Print Screen' to grab a screenshot by editing the file ~/.icewm/keys to include:

key "Print" mtpaint -s

A.4 Preferences

The preferences you choose in the preferences window are stored in the file .mtpaint

On GNU/Linux systems, it is placed in the user's home directory, and on Windows systems, in the user's profile directory. On Windows 9x, the root directory of the current drive is used instead (usually, C:\ ).

A.4.1 Touch Sensitive Tablets

It is possible to use the Preferences window to enable the use of touch sensitive tablets in mtPaint. Firstly, these devices need to be set up and tested using your operating system drivers. Once you have done this, you can then configure the 'Tablet' section of the Preferences window in order to affect tool size, flow and opacity. You should enable only one of the devices listed there, usually the one called "stylus". To test if this is working, use the tablet to apply pressure to the test area and you will see how much pressure has been registered.

A.4.2 Localized Translations

mtPaint can be compiled to use localized translations to help non English speaking people. If your copy of mtPaint has this feature, there will be a section of the Preferences window called 'Language' which you can use to choose a different language.

Each of these translations has been completed voluntarily by several mtPaint users who wish to make its features more accessible. Some of these translations are not complete. If you wish to complete any of these translations, or create new translations then you are advised to visit the mtPaint website so you can contact the maintainer in order to get instructions on doing this.

A.5 Limitations

The maximum image geometry is 16384x16384. The minimum geometry is 1x1.

After loading a new palette, the canvas may contain references to colours that are not defined. I call these orphan pixels. If you examine the image information via the Image menu you will see how many pixels have been orphaned. You can retrieve the pixels by expanding the palette to 256 items and then 'Palette->Remove Unused Colours'.

When using the colour A/B editor with an indexed image, if colour A = colour B, you must edit colour B to change its RGB.

Some key combinations may not work under certain window managers, e.g. Shift+F1-F12 or Ctrl+Mouse button.

Some buggy theme engines, like Oxygen-GTK2, can cause interface glitches or occasional crashes. The options are, either suffer through it, or disable the theme engine when running mtPaint, eg. using GTK2_RC_FILES shell variable.

Using the status bar items 'Cursor X,Y' and 'Pixel [ I ] {RGB}' can cause high CPU usage on older hardware when moving the cursor vigorously.

The maximum number of layers is 100.

GTK+ Text rotation does not work in Windows ME/95.

Files with overly long pathnames cannot be displayed or opened in Windows (if longer than 259 bytes in system's ANSI codepage encoding).

Screenshots, and colour picker (pipette) in colours editor window, do not work on Mac OS X with Quartz GTK+ backend.

A.6 Customizing mtPaint

One of the benefits of free software is that you have access to the source code so you can customize the program to suit your needs.

A.6.1 Creating Patterns

The patterns that mtPaint uses by default, reside in the source code file ./src/icons1/xbm_patterns.xbm. Each pattern is simply an 8x8 grid where colour index 0 (white) represents colour A, and index 1 (black), colour B.

If you want a different set of patterns, you can edit this file, or create your own, then save the new file somewhere safe and then refer to this file in the Paths section of the Preferences window.

While the original patterns are arranged in a 10x10 grid, a replacement file can be anything from 2x2 to 16x16 patterns, 8x8 pixels each. The pattern chooser will arrange the patterns the same way as they are in the file. The file must be a monochrome image (2 colour indexed palette) and its width and height must divide by 8 (so that it contains a whole number of patterns).

The 4x4 Bayer dither patterns are not stored in the patterns file, but instead generated from the "master pattern", a 4x4 matrix of nonrepeating numbers from 0 to 15. It is simply the order in which the pixels in each 4x4 grid will be filled, from #0 for 1/16 of colour A and 15/16 of B, all the way to #15 for 16/16 of A and none of B. The default order, the archetypal Bayer pattern, is represented by this line:

0,8,2,10 12,4,14,6 3,11,1,9 15,7,13,5

You can replace this master pattern by one your own; put a line describing it into the 'Bayer master pattern' entry box in the Preferences window. As an example, here is a line for the patterns used once upon a time by Deluxe Paint program; the archetypal pattern rotated 90 degrees counterclockwise and offset by 2 pixels on X and Y axes:

11,7,8,4 3,15,0,12 9,5,10,6 1,13,2,14

If the pattern you entered is invalid in some way (too short, too long, numbers repeat or out of range, characters that are not a digit, comma or space), mtPaint will clear the box and switch to default pattern after you close the Preferences window.

A.6.2 Creating Brushes

If you have a particular preference for certain types of brushes, such as circles or sprays, you can manually edit the sources to cater for your needs. Edit memory.c and find mem_brush_list which defines all of the brushes. Each entry is defined by a tool type, tool size and flow.

A.6.3 Custom Icons

The directory ./src/icons1 contains icons and mouse pointers that are compiled into mtPaint. It is possible to create custom icon sets to suit personal taste. For example in order to create and build a new set try:

Furthermore, an icon set can be partially or wholly replaced at runtime through GTK+ theming mechanism. For every "xpm_whatever.xpm" icon in the icon set, there is a corresponding stock ID "mtpaint_whatever", and mtPaint will display whatever other icon you assigned to that stock ID in a resource file, if you refer to that file as "Default theme" in the Paths section of the Preferences window.

Example resource file:


  gtk-icon-sizes="gtk-small-toolbar=22,22"
  style "mtPaint" {
    stock["mtpaint_brcosa"] = {{ "color-brightness-contrast.png", *, *, * }}
    # Other icon definitions go here
  }
  widget_class "*" style "mtPaint" 

Full documentation on relevant GTK+ resource file syntax can be found HERE, under the "Styles" heading.

A.6.4 Default Settings

mtPaint allows you to override the default configuration settings, using a global preferences file. On GNU/Linux systems, the file /etc/mtpaint/mtpaintrc is used; on Windows systems, the file mtpaintrc need be located in etc\mtpaint subdirectory under the mtPaint installation directory (i.e., ..\etc\mtpaint\mtpaintrc relative to where mtpaint.exe file is).

Packagers and distribution builders can use this to preconfigure mtPaint in a distribution-specific way; start mtPaint, modify whatever preferences you want, exit mtPaint, and copy the resulting ~/.mtpaint file to /etc/mtpaint/mtpaintrc

The area where such preconfiguring is needed most, is file actions - different distros provide different selection of preinstalled software, and some of programs which mtPaint would run by default may be unavailable on a specific distribution. In such cases, it's better to substitute another similar program, or to disable the action entirely, than to confuse users by actions which do not work.

A packager of a fully portable build can use mtpaintrc to relocate the user preferences file (~/.mtpaint) from its default place in the current user's home directory to, say, somewhere under the installation directory. To do so, add a line "userINI = /path/filename" to mtpaintrc

Paths starting with "~", like "~/.mtpaint", point into the home directory. On Windows, paths starting with a drive letter are absolute, and ones starting with a "\" or "/" are taken to be package-relative just as "/etc/mtpaint/mtpaintrc" itself is. No path at all (just "userINI =") means, user preferences will be saved to mtpaintrc file as the new default configuration.

A.7 File Actions

The 'Actions' section of the File menu can be used to send the current image file to another program, such as a web browser or email client. The implementatation varies between GNU/Linux and Windows systems due to the different underlying system structures. In both cases though you can configure up to 25 items, with each having a text description (Action), a command and a directory in which the command will be run. The first 15 items will be placed in the menu as presets. If you don't want an item to appear as a preset then you can place a '#' character at the beginning of the Action. You can re-order the items in the list by dragging and dropping them in the list.

When editing the command, the current image file is represented by using '%f' which is substituted when the command is run.

Additionally, if a program requires, or prefers, a specific image file format and/or pixel format, you can begin the command with "conversion statements": ">" character followed by name of what you want and a space. For a file format, use either its file extension, or the name used for the format in mtPaint, e.g. either ">jpg" or ">jpeg" for JPEG; either ">jp2", ">jpc", or ">jpeg2000" for JPEG2000. To do an indexed to RGB conversion, add ">rgb"; otherwise, conversion will be done if the file format is RGB-only. Statements requesting impossible things, like saving an RGB image as an XBM file, will be ignored.

The same way, you can add ">%" to get more variables than just '%f'. An example is worth more than a wordy explanation:

>% echo Filename %N Selection X=%x Y=%y width %w height %h Cursor at %X,%Y Image width %W height %H, %B bytes/pixel, %A alpha, %S selection, %M mask, %C colours in palette, %T transparent

A.7.1 GNU/Linux Systems

The GNU/Linux version of mtPaint comes pre-loaded with some examples of file actions. The command is executed using the shell command sh, so in the case of bash you can use more than one command by separating them with a semi colon. For example this command waits for 5 seconds and then grabs a screenshot:

sleep 5; mtpaint -s &

Because commands are run through the shell you can use any shell facilities like pipes, redirection, and wildcards.

A.7.2 Windows Systems

To run a program using the Windows version of mtPaint you must place the whole path of the program in the command box. For example the following command starts MS Paint editing the current image (in Windows XP or Window 98 respectively):

C:\WINDOWS\system32\mspaint.exe %f

C:\Program Files\Accessories\MSPAINT.EXE %f

A.8 Image Loading and Saving

These functions may seem obvious, but there is more to them than meets the eye.

First, file selector supports tab completion and wildcards. For example, if you type "p" into the entry box and press tab, only files beginning with "p" will be displayed. If you type "dsc*.jpg" into the entry box and press tab, the file list will only display files beginning with "dsc" and ending with ".jpg". As you would expect the * wildcard represents any number of characters and the ? wildcard represents exactly one character.

Then, there is undoable loading. If you enable it, loading a new image file is treated like an ordinary image modification - you can undo it, and return to the image you were working with before. This way, if you want to add to the current image a piece of another, you don't need to open a separate instance of mtPaint for that; just load the second image in undoable mode, copy the needed part of it to clipboard, undo the load, and paste the clipboard into the first image.

Another use of undoable loading is image comparison. You can load two (or more) images one after another, and then quickly switch back and forth between them using the keyboard shortcuts for undo and redo (Ctrl+Z and Ctrl+R).

As for saving, the choice of image file formats which mtPaint offers you depends on the image you're trying to save - its type (RGB or indexed) and number of colours in it. If it isn't possible to save the image in a given format, it is simply not offered - which doesn't mean that the format is unavailable, but that you need to convert the image to an acceptable type and/or number of colours. See the "Image Type" column of the table in section A.2 for requirements of specific image formats.

A.9 Command Line Options

mtPaint understand the following command line options:

You cannot intermix file names with options other than '-w', nor put any options at all (including '-w') after the '--'. This prevents mishandling file names of the stranger sort (like say a PNG file called "-v") as options.

The '--cmd' option (scripting mode) cannot coexist with any other options; to be recognized it must be the first option, and everything after it is script commands, maybe followed by '--' and a filename or several.