How to Create Custom Colormaps in Digital Micrograph

The default colormap in Digital Micrograph is greyscale, but different applications or communities ofter use other colour look-up tables (CLUT) to highlight certain features or present data more artistically. You can see your colour scale choices in DM by right-clicking on an image and selecting “ImageDisplay…” or by pressing ctrl+D, then selecting ‘Display’ > ‘Color’, you will see something like this:

DM Colormap

You will see a 16×16 array of increasing shades (256 in total) that defines the colormap.The most direct (but most painful) way to create a new colormap is to click on each of these squares and adjust the colour values, when you’re done click ‘Save’. That requires you to make 256 individual, and smoothly graduated, selections and is rather painful.

Instead, we can create the necessary colormap using scripting; in this example by using Matlab.

The first thing to know is that DM just stores the colormaps in a hidden folder in the installation as a 16×16 pixel RGB image. Once you know that it’s just a case of creating the right sort of image and storing it in the right place.

Creating the RGB Colormap

First, we will use Matlab to create the RGB image we need from one of its in built colormaps.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
clear all
% Create a dummy figure with no content:
figure
% Create the colormap:
colormap hot(256)
cmap = colormap ;
 
% Reshap this to an RGB image:
RGB = reshape(cmap,16,16,3) ;
% Transpose to suit DM order:
RGB = permute(RGB,[2 1 3]) ;
% Write this image to disk:
imwrite(RGB,'RGB.tiff')
 
% Close the dummy figure:
close all

This will give you a colour image file on the disk, as a TIFF, which has the correct properties for the next stage.

16x16 RGB

At 16×16 pixels it doesn’t look like much but it’s okay. Next, open this TIFF in Digital Micrograph:

DM Hot Colormap

Now save this as both a *.dm3 file and a *.dm4 file. The names of the files should be the same and will be the name of your new colormap in the menu. Finally, both these files should be copied to a hidden folder in the Gatan installation at:

“C:\Users\**Username**\AppData\Local\Gatan\ColorTables”

while replacing **Username** with your own user name. If that folder doesn’t exist you should create it.

DM Hot

Select the new colormap and you’re done!

Colormaps

One thought on “How to Create Custom Colormaps in Digital Micrograph

  1. Ta-Kun Chen

    Hi Lewys,

    An alternative easy way to create simple color maps in DM, is to click the first square (upper-left) and drag your mouse to the final square (bottom-right) before you release the left mouse button. After input a color for the first square and the other for the final square, DM will create a linear interpolation in between these two colors.

    But your way provides much more possibilities. However I could not see the hidden folder you mentioned. In the file path I only see “Plugins” and “Prefs” even when I changed the setting to show hidden folders.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>