From sfx
Revision as of 15:28, 25 July 2018 by Paul (talk | contribs) (→‎Methods)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A MediaFormat object is used to describe an installed image I/O module.


A MediaFormat object can be constructed by either the format name or from a path, where it will attempt to detect the format from the image file. Construction will throw an exception if the format is not supported or cannot be determined from the path.

<source lang="python"> >> cineon = MediaFormat('Cineon') >> format = MediaFormat(None, path='/path/to/image.jpg') >> print 'JPEG' </source>


All attributes are read-only.

Name Description Added
alpha True if the format supports embedded alpha
audio True if the format supports audio I/O
extension The default format extension
hdr True if the format supports high-dynamic-range (float) data
name The format name
premultiplied True if the format is inherently premultiplied
readable True if the format supports read
streaming True if the format is a streaming format (ie. Quicktime)
version The module version as a float
video True if the format supports video/image I/O
writeable True if the format supports write
multiPart True if the format supports multi-part files 6.0
dataWindow True if the format supports separate data/display windows 6.0


Method Description Added
create(path) Create a file of the format's type.
putImage(raster, frame=0, part=None, channels=Channel_RGBA, pixelAspect=1, frameRate=0,premultiply=False,roi=None,displayWindow=None,metadata=None,part=None) Write the raster to the file. Maybe be called more than once if the format supports multiple parts. If roi is specified, only write the ROI clipped to the raster's DOD.
close() Close the file.
parts(path) Returns the parts in a multi-part file. 6.0


List installed formats[edit]

<source lang="python"> formats = fx.mediaFormats() print formats </source>