Specific Data Import

Import of several other types of data is not automatic and it requires human intervention.

Graphics Formats

Importing data from image formats such as PNG, TIFF, JPEG or BMP is similar to import from raw/unknown file formats, only simpler.

It is simpler because the file structure is known and the file format is automatically detected. Hence the file type does need to be selected explicitly. However, the data interpretation is still unknown and must be specified manually. The Pixmap import dialog therefore resembles the Information tab of raw data import, requiring you to set the physical dimensions and value scale.

Note the physical dimensions suggested there are not obtained from the file, they are simply the last values used. Some SPM data format are based on an image format (typically, TIFF is used as the base) and contain the information about physical scales and units, albeit stored in a manufacturer-specific way. In this case a separate import module can be written for this particular format to load the files automatically with correctly scaled values.

See the reference section High-Depth Image Formats for the details of support for high-depth images and the possibility of using them for data representations.

Graph Curves

Simple two-column text files containing curve data can be imported as graph curves. In some cases, these files are recognized automatically. They can also be explicitly selected as ASCII graph curve files in the file open dialog, causing the import module to try harder to load the file as a graph data.

The import dialog shows a preview of the graph and permits to set the units and labels.

XYZ Data

Three-column text files containing XYZ data are imported by selecting the XYZ data files file type. Again, they can be recognized automatically but requesting this format explicitly makes the module to try harder to load the file as XYZ data.

Since Gwyddion only works with data in a regular grid, irregular XYZ data must be interpolated to a regular grid upon import. In fact, the XYZ data import module serves two different purposes:

  • loading of data in a regular grid that were just saved as XYZ data – if the data is found to be in a regular grid only a very simple import dialog is presented where you can set the units because the import is straightforward;
  • regularization and interpolation of irregular XYZ data – this case is much less straightforward and the rest of this section will discuss the options you have and some of the pitfalls.

The import dialog permits to set the basic parameters as the regularized data resolution and range and lateral and value units. However, the most important option is Interpolation type:


This interpolation is analogous to the Round interpolation for regular grids. The interpolated value in a point in the plane equals to the value of the nearest point in the XYZ point set. This means the Voronoi triangulation is performed and each Voronoi cell is filled with the value of the nearest point.


This interpolation is analogous to the Linear interpolation for regular grids. The interpolated value in a point is calculated from the three vertices of the Delaunay triangulation triangle containing the point. As the tree vertices uniquely determine a plane in the space, the value in the point is defined by this plane.


The value in a point is the weighted average of all the XYZ point set where the weight is proportional to the inverse fourth power of the mutual distance. Since all XYZ data points are considered for the calculation of each interpolated point this method can be very slow.


Ad hoc method obtaining pixel values using a combination of simple averaging and propagation. In dense locations where many XYZ points fall into a single pixel the value assigned to such pixel is a sort of weighted mean value of the points. In sparse locations where relatively large regions contain no XYZ data points the pixel value is propagated from close pixels that contain some XYZ data points. The main feature of this interpolation type is that it is always fast while often producing quite an acceptable result.

The former two interpolation types are based on Delaunay/Voronoi triangulation which is not well-defined for point sets where more than two points lie on a line or more than three lie on a circle. If this happens the triangulation fails and the import module displays an error message.

The values outside the convex hull of the XYZ point set in the plane are influenced by Exterior type:


The point set is not amended in any way and the values on the convex hull simply extend to the infinity.


The point set is amended by points reflected about the bounding box sides.


The point set is amended by periodically repeated points from around the opposite side of bounding box.

Delaunay triangulation displayed on top of (a) Linear, (b) Round, (c) Field and (d) Average interpolations of an irregular set of points. Since the points are sparse, Average interpolation is quite similar to Round, only a bit blurred.