{"id":23704,"library":"fabio","title":"FabIO - I/O library for X-ray detector images","description":"FabIO is a Python library for reading and writing images produced by 2D X-ray detectors. It supports over 20 file formats (e.g., EDF, Mar, Pilatus, TIFF, HDF5). Version 2025.10.0 requires Python >=3.10. Release cadence is roughly monthly, with versioning based on date (YYYY.MINOR.PATCH).","status":"active","version":"2025.10.0","language":"python","source_language":"en","source_url":"https://github.com/silx-kit/fabio","tags":["x-ray","detectors","image-io","scientific","crystallography"],"install":[{"cmd":"pip install fabio","lang":"bash","label":"Install from PyPI"},{"cmd":"conda install -c conda-forge fabio","lang":"bash","label":"Install via conda"}],"dependencies":[{"reason":"Core dependency for array handling","package":"numpy","optional":false},{"reason":"Required for HDF5 support (e.g., Eiger, P10)","package":"h5py","optional":true},{"reason":"Required for TIFF support","package":"PIL","optional":true},{"reason":"Required for Mar/CCP4 format","package":"lxml","optional":true}],"imports":[{"note":"","wrong":"","symbol":"fabio","correct":"import fabio"},{"note":"openimage is a function, not a direct importable symbol from the top-level package.","wrong":"from fabio import openimage","symbol":"openimage","correct":"fabio.openimage(filename)"}],"quickstart":{"code":"import fabio\nimport numpy as np\n\n# Read an image\nimg = fabio.openimage('example.edf')\ndata = img.data\nprint('Shape:', data.shape)\n\n# Create and write a simple image\nfrom fabio.edfimage import EdfImage\nnew_data = np.random.rand(100, 100)\nnew_img = EdfImage(data=new_data)\nnew_img.write('output.edf')\nprint('Written output.edf')","lang":"python","description":"Basic read and write operations using FabIO."},"warnings":[{"fix":"Update imports to use 'fabio.<format>image' submodule pattern.","message":"In version 2020.x, the 'cbf' module was refactored. Import paths for CBF-specific readers have changed. Use 'from fabio.cbfimage import CbfImage' instead of old 'from fabio.cbf import Cbf'. Affects code written before 2020.","severity":"breaking","affected_versions":"<2020"},{"fix":"Replace 'from fabio.input import EdfInput' with 'from fabio.edfimage import EdfImage' and use the object's methods.","message":"The 'fabio.input' and 'fabio.output' modules are deprecated since version 2023. Use the format-specific image classes (e.g., EdfImage, Mar345Image) directly.","severity":"deprecated","affected_versions":">=2023"},{"fix":"Wrap openimage() in a try/except to catch IOError or ValueError. Validate files offline with 'fabio -c file.edf' command-line tool.","message":"FabIO's openimage() does not guess the file format from extension alone; it reads the header. If the file is malformed, it may raise an unexpected error.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install fabio' in your active Python environment.","cause":"FabIO is not installed, or installed in a different environment.","error":"ModuleNotFoundError: No module named 'fabio'"},{"fix":"Use a concrete subclass like 'from fabio.edfimage import EdfImage' or obtain an image via 'fabio.openimage()'.","cause":"FabIOImage is an abstract base class; users mistakenly try to instantiate it.","error":"fabio.fabioimage.FabIOImage cannot be instantiated directly"},{"fix":"Check the return value: 'img = fabio.openimage(filename); if img is None: raise IOError(\"Unsupported format\")'.","cause":"openimage() returns None if the file is not recognized. User assumes it always returns an image object.","error":"AttributeError: 'NoneType' object has no attribute 'data'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}