| IOFormat Python 1.8.0

Loading...
Searching...
No Matches
Classes | Functions | Variables
ioformat.ioformat Namespace Reference

## Classes
class | _SwigNonDynamicMeta
class | Logger
class | StackReader
class | StackWriter
class | VersionInfo
class | Versioning

## Functions
| _swig_repr (self)
| _swig_setattr_nondynamic_instance_variable (set)
| _swig_setattr_nondynamic_class_variable (set)
| _swig_add_metaclass (metaclass)
| init ()
| read_image (pathFile)
| open_view (*args)
| open_writer (*args)
| write_view (*args)
| format_from_extension (extension)

## Variables
| cvar = _ioformat.cvar
| IOFORMAT_VERSION = cvar.IOFORMAT_VERSION
| IOFORMAT_VERSION_STRING = cvar.IOFORMAT_VERSION_STRING
| IOFORMAT_SHA = cvar.IOFORMAT_SHA

## Detailed Description

    !@file ioformat.py
    @brief IOFormat Python API

## Function Documentation

## ◆ _swig_add_metaclass()

ioformat.ioformat._swig_add_metaclass | ( |  | metaclass | ) |
| protected

    Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass

## ◆ format_from_extension()

ioformat.ioformat.format_from_extension | ( |  | extension | ) |

    Helper to retrieve a format from an extension.

    Extension are case insensitive, so for example "png" and "PNG" are the same
    for this function, and will return the same format.

    :type extension: string
    :param extension: string which contains the extension to identify (without dot)
    :rtype: string
    :return: a string containing the format identifier corresponding to this extension

## ◆ init()

ioformat.ioformat.init | ( |  | ) |

    Force IOFormat initialization.
    If not called, it will be initialized at the first call of any following methods.
    This method allows you to force the loading of all the IOFormat plugins.
    It may take some time, depending on the number of plugins to load.
    :rtype: boolean
    :return: true if at least one plugin was correctly loaded, false otherwise

## ◆ open_view()

ioformat.ioformat.open_view | ( | * | args | ) |

    *Overload 1:*

    Access to data from given file, using the extension of the file to determine format
    :raises: iolink::Error
    :raises: iolink::InvalidArgument
    :raises: ioformat::UnsupportedFormat

    |

    *Overload 2:*

    Open a View on the file at the given path, forcing to a specific format.

    :type path: string
    :param path: The path to the file
    :type format: string
    :param format: The format to use to read the file

    :raises: UnsupportedFormat When the extractor selected according to the format cannot read the file.

    |

    *Overload 3:*

    Access to data from Uniform Resource Identifier, using the extension of the path to determine format
    :raises: iolink::Error

    |

    *Overload 4:*

    Access to data from Uniform Resource Identifier, using the given format to decode it
    :raises: iolink::Error

    |

    *Overload 5:*

    Access to data from given storage, using the given format to decode it
    :type storage: :py:class:`DataAccess`
    :param storage: input storage containing the data to decode with given format
    :type format: string
    :param format: file format to apply on given stream to decode
    :raises: iolink::Error
    :raises: iolink::InvalidArgument
    :raises: ioformat::UnsupportedFormat

## ◆ open_writer()

ioformat.ioformat.open_writer | ( | * | args | ) |

    *Overload 1:*

    Open a writer used to write an image view into a file.

    :type view: :py:class:`View`
    :param view: The view that will be written
    :type pathFile: string
    :param pathFile: a path to the output file.

    :rtype: :py:class:`Writer`
    :return: A writer ready to write the image into the file.

    |

    *Overload 2:*

    Open a writer used to write an image view into an output stream.

    :type view: :py:class:`View`
    :param view: The view that will be written
    :type dst: :py:class:`DataAccess`
    :param dst: The output stream where the encoded data will be written.
    :type format: string
    :param format: The format to use to encode the image.

    :rtype: :py:class:`Writer`
    :return: A writer ready to write the image into the output stream.

    |

    *Overload 3:*

    Open a writer used to write an image view into an output stream.

    :type view: :py:class:`View`
    :param view: The view that will be written
    :type dst: :py:class:`DataAccess`
    :param dst: The output stream where the encoded data will be written.
    :type format: string
    :param format: The format to use to encode the image.
    :type plugin: string
    :param plugin: The specific plugin to use.

    :rtype: :py:class:`Writer`
    :return: A writer ready to write the image into the output stream.

## ◆ read_image()

ioformat.ioformat.read_image | ( |  | pathFile | ) |

    Access to data from given file, using the extension of the file to determine format.
    Image is fully loaded in memory.
    Limitation:
    - If file contains more than one image (like an image and its thumbnail),
    this method will only load first read frame.
    - If file contains a LOD image, resolution-0 image is read
    - If data is not an image or is not readable, an UnsupportedFormat exception is thrown
    :raises: iolink::Error
    :raises: ioformat::UnsupportedFormat

## ◆ write_view()

ioformat.ioformat.write_view | ( | * | args | ) |

    *Overload 1:*

    Save a view into a file.

    :type view: :py:class:`View`
    :param view: The view to save
    :type pathFile: string
    :param pathFile: The path of the file where to save the image

    :raises: iolink::Error When the image cannot be written

    |

    *Overload 2:*

    Save a view into a storage.

    :type view: :py:class:`View`
    :param view: The view to save
    :type dst: :py:class:`DataAccess`
    :param dst: The storage where to save the image
    :type format: string
    :param format: The format in which the image will be encoded

    :raises: iolink::Error When the image cannot be written