Various CBF Readers

This page presents a selection of programs that can read the Crystallographic Binary File (CBF) format produced by PILATUS detectors. By default, PILATUS detectors write CBF files with header information minimized to what is necessary for processing by typical crystallographic programs (like XDS). Through a template mechanism, it is possible to extend those CBF files to the full specification. However, this is implemented in very few cases only. The following sections highlight software for the cbf format as written by default.

To learn more about the format, read about the full CBF image specification and about the DECTRIS implementation.


The following examples were written by different users mainly using the cbf library. These examples are for information only. They are not tested and we do not take any responsibility regarding the functionality of the programs.


These simple compress and decompress functions written in C are part of the bigger TVX code (used to control the Pilatus detectors) and should give a good starting point for integration.


ALBULA offers a Python API that allows manipulation of CBF files. Download it here, then start with Teemu Ikonen's code:


A set of Matlab tools that include the functionality of reading cbf files can be found on the homepage of the cSAXS beamline at the SLS (Paul Scherrer Institut).


The routine below was written by Patrick Huber (PSI & ETHZ).

Other examples

  • SAXSVIEW contains svimage, a tool for displaying 2D scattering images in CBF format.
  • Marc Rivers at the University of Chicago wrote an EPICS areaDetector driver for the PILATUS detector.
  • CBF reader plug-in for cbf images taken at IMCA-CAT at Advanced Photon Source.  This code will need modifications for general usage.
  • The DIALS project was initiated to create processing tools for a wide variety of crystallographic data. Among others, it provides a CBF reader.
  • Cbf_to_sfrm is code to convert cbf images into sfrm format. It was written by Natalie Johnson from the lab of Michael Probert at Newcastle University, UK. The code supports data from the I19 beamline at Diamond Light Source. Support for data from other diffractometers and beamlines may require modification of the open source code for correct angle conversions.

If you have suggestion or links to other programs, please let us know at