Scripting Resources for DigitalMicrograph™


Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio | Private | Search


Multiple Saves As Hi-Res TIFF
Saves all the currently open images to the selected directory as 8 bit TIFF images at full resolution.

version:20170219, v2.0

D. R. G. Mitchell

The native .dm4 (or .dm3 for earlier GMS 1) Gatan format is the best image format to save in, as it ensures the maximum amount of data gets preserved in the image, including annotations and meta data in the image tags. However, aside from ImageJ (with the appropriate plugin installed), DigitalMicrograph files cannot be read by typical graphics programs like Paint or Preview. TIFF (8 bit) is a universal format which these programs can read. Save all your images during your session as .dm4. Then at the end of the session reopen them all into DM and run this script. TIFF files can be written back to the directory containing the .dm4 files - just click on 'Save' in the 'Save As' dialog.

As of GMS 2 there is a built-in batch file converter (File/Batch Convert) which does the same thing.

In general you should do everything you can (image processing, measurement, annotation etc) with the images in their native .dm4 format and only convert them to TIFF right at the end - eg for submission to a journal. Although 8 bit TIFFs will waste a huge amount of dynamic range, they are the still adequate for many purposes. However, avoid formats such as JPEG, which use compression. These are lossy formats and, as the name suggests, information is lost. The only time you might consider JPEG, is if perhaps you were emailing a few images to a collaborator for some comments. Such files can be a few hundred kilobytes in size, in contrast to perhaps10-40MB for a native image.

System Requirements
Should be compatible with all recent versions of DigitalMicrograph. The old version of this script directly accessed the Results window object - which stopped being accessible in GMS 2. Hence this script no longer worked. The script has been edited to fix this.
Known Issues

This is equivalent to saving images with the 'File/Save Display As' option. Note if you use 'File/Save As' and select the TIFF format, your images will be in 16 bit format, which not many graphics programs can read.

The manner in which your TIFF files get saved by this script : screen resolution vs native, indexed colour vs greyscale etc is set when using the preferences you have in place when you save an image using File/Save Display As . . Normally you can set these preferences each time you invoke that menu function. However, if you have checked the 'Do Not Prompt' option in this dialog - then it is hidden. To adjust the settings select File/Global Info/Saving and you can then set those parameters in that dialog, and check an option to make the prompt reappear each time you invoke Save Display As . . if you so wish.

Included Files
Main script file.
Source Code

// see attached script