Managing Files

Gwyddion uses its custom data format (.gwy) to store data. This format has the following important advantages:

Therefore, we recommend to use this format for saving of processed files.

Other data file formats are handled with appropriate file loading and saving modules. Beside a large number of file formats used in scanning probe microscopy, graphical file types (PNG, JPEG, TIFF, TARGA) and raw binary and text data can be imported too. If your SPM data format is not supported by Gwyddion yet or it is loaded incorrectly, you are encouraged to write an import module (if you can program) or contact the maintainers to help them improve the support.

The list of all supported file formats can be found in chapter Summaries and Tables.

File Loading

Files are opened using FileOpen. The file type is detected automatically, based solely on the file content. Since the same extensions such as .img, .afm or .dat are used for many different SPM file types this approach is superior to relying on file extensions.

The only exception is the import of various raw data, either two-dimensional or graph, that must be chosen explicitly in the file open dialogue. See sections Raw Data File Import for details of import of raw data and manual extraction of data from unsupported formats and Specific Data Import for import of XYZ data, pixmap image data and graph data.

The list of files in the file open dialogue can be limited to only files Gwyddion recognizes as loadable by enabling the Show only loadable files option. The file type label then indicates the filtering by appending (filtered) to the end. This can be often convenient, on the other hand it can slow down listing of directories with many files.

The file list can be also filtered by name using the Filter entry in the lower part. You can enter either a file glob such as *.dat or a file name fragment such as carbo. Press Enter to update the list after modifying the filter.


Filters and raw import options are remembered. If you open the file chooser after a while and files seem to be missing or suddenly not loadable, check the filtering and file type settings.

A preview of the file content is show on the right side (for automatically loadable files). The small text above the preview shows the file type, i.e. name of the module used to load the file, and the number of images (img), graphs (gr), single-point spectra (sp), volume data (vol) and XYZ data (xyz) in the file.


The preview of image channels can display the data be plane-levelled and/or row-corrected. This is controlled by the small buttons below the preview list.

File open dialogue with expanded file type options and file content preview.

File Merging

File merging, performed by FileMerge, is similar to normal file loading, except that the selected file (or files) is merged into the current open file. In other words, images, graphs and other types of data are added to those already present in the current file, together with all their settings and properties.

File Saving

Much of the previous paragraphs applies to file saving too. One of the main differences is the reliability of automatic file type determination. While loading can and does examine the file contents, saving depends on file name and extension. Combined with the large number of different file types using the same extension such as .img, .afm or .dat it leads to ambiguities. Select the file type explicitly before saving if you are unsure.

Since the only file type able to fully represent Gwyddion data structures is its native data format, saving to a .gwy file is the only proper saving. Saving to other file formats essentially consists of exporting of a limited subset of the data, typically only the active image (without masks and presentations). Therefore it does not change the file name of the current file to the just saved file name.

FileSave as... can also be used to export image data to graphics formats. Just enter foo.png as the file name to export a PNG image the current channel, similarly for other formats.

Document History

The history of recently opened files can be accessed with FileOpen Recent. The submenu contains the last 10 recently used files for quick recalling, an extensive recent file history is accessed with the last item Document History.

Document history lists the files sorted by the last access time (the most recently accessed at the top), with previews and some additional information about a selected channel. The function of the bottom row of buttons is following:

Clean Up
Removes history entries of files that have been deleted or are no longer accessible for other reasons.
Closes the document history window.
Opens the selected file. This can be also achieved by activating the selected row, either by double-clicking or with the keyboard.

The history can be searched/filtered by file name using the filter controls above the buttons. The filter is activated by pressing Enter in the filter pattern entry. To display all history entries, clear the entry and activate it. The filter pattern is interpreted in two ways:

  • If the pattern contains wildcards, i.e. * or ?, it is interpreted as file glob. This means ? represents a single arbitrary character, * represents an arbitrary sequence of zero or more characters, and the file name has to precisely match the pattern. Note directory separators (/ or \) are not treated specially, therefore in the pattern *.sis the initial * matches all leading directory components. The pattern syntax is described in GPatternSpec documentation.
  • If the pattern does not contain any wildcards, it is directly searched as a part of the file name.

Search case sensitivity, controlled by option Case sensitive, is useful mainly on systems distinguishing letter case in file names, such as Unix. On systems that do not distinguish the case themselves it is recommended to keep the setting on case insensitive.