imformats
Manage supported image formats.
📝Syntax
imformats ()
formats = imformats()
format = imformats(ext)
📥Input Arguments
Parameter Description
ext File format extension: character vector or string scalar.
📤Output Arguments
Parameter Description
formats structure array: supported image formats.
format structure: supported image format.
📄Description

imformats returns the list of supported image formats.

formats = imformats() returns the list of supported image formats in a structure array.

format = imformats(ext) returns the structure of the image format corresponding to the extension ext.

Each element of the structure array contains the fields:

The registry is deterministic and does not depend on desktop image plugins. An empty read or write field means that the operation is not supported. In the array returned without an argument, these fields contain the function name; a single-format query returns the equivalent function handle.

Canonical extension Aliases Read Write Alpha Multipage
png - yes yes yes no
jpg jpeg, jfif yes yes no no
gif - yes yes yes yes
webp - yes yes yes no
tiff tif yes yes yes no
bmp dib yes yes yes no
tga - yes yes yes no
pbm - yes yes no no
pgm - yes yes no no
ppm - yes yes no no
pnm - yes yes no no
pcx - yes yes no no
psd - yes no yes no
hdr rgbe yes no no no
pic - yes no yes no
💡Examples
imformats()
Query a format by an alias.
imformats('jpeg')
imformats('webp')
Filter readable and writable formats.
formats = imformats();
readable = {};
writable = {};
for k = 1:length(formats)
    if ~isempty(formats(k).read), readable{end + 1} = formats(k).ext; end
    if ~isempty(formats(k).write), writable{end + 1} = formats(k).ext; end
end
readable
writable
🔗See Also
imwriteimread
🕔Version History
Version Description
1.13.0 initial version
2.0.0 deterministic cross-platform format registry
Edit this page on GitHub