Main Content

Read and Write Image Data from Files

Read and write image data from files, get information about contents of image files

Image Processing Toolbox™ enables you to read and write image files in many common file formats including BMP, GIF, JPEG, PNG, and TIFF. The toolbox supports reading and writing medical file formats including DICOM, NIfTI, and Analyze 7.5. The toolbox also supports reading RAW file formats. You can also work with images in specialized file formats, including NITF, DPX, and Interfile.


DICOM BrowserExplore collection of DICOM files


expand all

imreadRead image from graphics file
imwriteWrite image to graphics file
imfinfoInformation about graphics file
dicominfoRead metadata from DICOM message
dicomfindFind location and value of target attribute in DICOM metadata
dicomupdateUpdate value of target attribute in DICOM metadata
dicomreadRead DICOM image
dicomwriteWrite images as DICOM files
dicomreadVolumeCreate 4-D volume from set of DICOM images
dicomCollectionGather details about related series of DICOM files
dicomContoursExtract ROI data from DICOM-RT structure set
dicomanonAnonymize DICOM file
dicomdictGet or set active DICOM data dictionary
dicomdisp Display DICOM file structure
dicomlookupFind attribute in DICOM data dictionary
dicomuidGenerate DICOM globally unique identifier
images.dicom.decodeUIDGet information about DICOM unique identifier
images.dicom.parseDICOMDIRExtract metadata from DICOMDIR file
rawinfoRead metadata from RAW file
rawreadRead color filter array (CFA) image from RAW file
raw2rgbTransform Color Filter Array (CFA) image in RAW file into RGB image
planar2rawCombine planar sensor images into full Bayer pattern CFA
raw2planarSeparate Bayer pattern Color Filter Array (CFA) image into sensor element images
tiffreadVolumeRead volume from TIFF file
niftiinfoRead metadata from NIfTI file
niftiwriteWrite volume to file using NIfTI format
niftireadRead NIfTI image
analyze75infoRead metadata from header file of Analyze 7.5 data set
analyze75readRead image data from image file of Analyze 7.5 data set
interfileinfoRead metadata from Interfile file
interfilereadRead images in Interfile format
nitfinfoRead metadata from National Imagery Transmission Format (NITF) file
nitfreadRead image from NITF file
isnitfCheck if file is National Imagery Transmission Format (NITF) file
dpxinfoRead metadata from DPX file
dpxreadRead DPX image


Read and Write Standard Graphics Files

Image Types in the Toolbox

Image types determine how MATLAB® interprets data matrix elements as pixel intensity values. The toolbox supports many image types including binary, grayscale, truecolor, multispectral, and label images.

Work with RAW Files

Implement Digital Camera Processing Pipeline

This example shows how to implement a camera processing pipeline that renders an RGB image from a RAW Bayer-pattern color filter array (CFA) image.

Work with DICOM and Other Medical Files

DICOM Support in Image Processing Toolbox

The Digital Imaging and Communications in Medicine (DICOM) Standard facilitates access to image data and files across medical imaging equipment.

Mayo Analyze 7.5 Files

Analyze 7.5 is a file format, developed by the Mayo Clinic, for storing MRI data.

Interfile Files

Interfile is a file format that was developed for the exchange of nuclear medicine image data.

Featured Examples