# guiqwt.io

The io module provides input/output helper functions:

  - `guiqwt.io.imread()`: load an image (.png, .tiff, .dicom, etc.) and return its data as a NumPy array

  - `guiqwt.io.imwrite()`: save an array to an image file

  - `guiqwt.io.load_items()`: load plot items from HDF5

  - `guiqwt.io.save_items()`: save plot items to HDF5

## Reference

guiqwt.io.imread(fname, ext=None, to_grayscale=False)

  Return a NumPy array from an image filename fname.

  If to_grayscale is True, convert RGB images to grayscale The ext (optional) argument is a string that specifies the file extension which defines the input format: when not specified, the input format is guessed from filename.

guiqwt.io.imwrite(fname, arr, ext=None, dtype=None, max_range=None, **kwargs)

  Save a NumPy array to an image filename fname.

  If to_grayscale is True, convert RGB images to grayscale The ext (optional) argument is a string that specifies the file extension which defines the input format: when not specified, the input format is guessed from filename. If max_range is True, array data is scaled to fit the dtype (or data type itself if dtype is None) dynamic range Warning: option max_range changes data in place

guiqwt.io.load_items(reader)

  Load items from file (HDF5, JSON, …): * reader: `guidata.dataset.io.HDF5Reader` or

  > `guidata.dataset.io.JSONReader` object

guiqwt.io.save_items(writer, items)

  Save items to HDF5 file: * writer: `guidata.dataset.io.HDF5Writer` object * items: serializable plot items