Generic Image Library: I/O

###  | #  |

Topics | Functions
I/O

Support for reading and writing images to file. More...

## Topics
| JPEG I/O
| Support for reading and writing JPEG image files.
| TIFF I/O
| Support for reading and writing TIFF image files.
| PNG I/O
| Support for reading and writing PNG image files.

## Functions
template<typename Reader , typename Image >
void | read_and_convert_image (Reader &reader, Image &img, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type *=nullptr)
| Reads and color-converts an image. Image memory is allocated.
template<typename Reader , typename View >
void | read_and_convert_view (Reader &reader, View const &view, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type *=nullptr)
| Reads and color-converts an image view. No memory is allocated.
template<typename Reader , typename Image >
void | read_image (Reader reader, Image &img, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t >, is_read_supported< typename get_pixel_type< typename Image::view_t >::type, typename Reader::format_tag_t > >::value >::type *=nullptr)
| Reads an image without conversion. Image memory is allocated.
template<typename Device , typename FormatTag >
auto | read_image_info (Device &file, image_read_settings< FormatTag > const &settings, typename std::enable_if< mp11::mp_and< detail::is_adaptable_input_device< FormatTag, Device >, is_format_tag< FormatTag > >::value >::type *=nullptr) -> typename get_reader_backend< Device, FormatTag >::type
| Returns the image format backend. Backend is format specific.
template<typename Reader , typename View >
void | read_view (Reader reader, View const &view, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, typename is_format_tag< typename Reader::format_tag_t >::type, typename is_read_supported< typename get_pixel_type< View >::type, typename Reader::format_tag_t >::type >::value >::type *=nullptr)
| Reads an image view without conversion. No memory is allocated.
template<typename Writer , typename View >
void | write_view (Writer &writer, View const &view, typename std::enable_if< mp11::mp_and< typename detail::is_writer< Writer >::type, typename is_format_tag< typename Writer::format_tag_t >::type, typename is_write_supported< typename get_pixel_type< View >::type, typename Writer::format_tag_t >::type >::value >::type *=nullptr)
template<typename Device , typename View , typename FormatTag >
void | write_view (Device &device, View const &view, FormatTag const &tag, typename std::enable_if< mp11::mp_and< typename detail::is_write_device< FormatTag, Device >::type, typename is_format_tag< FormatTag >::type, typename is_write_supported< typename get_pixel_type< View >::type, FormatTag >::type >::value >::type *=nullptr)
template<typename String , typename View , typename FormatTag >
void | write_view (String const &file_name, View const &view, FormatTag const &tag, typename std::enable_if< mp11::mp_and< typename detail::is_supported_path_spec< String >::type, typename is_format_tag< FormatTag >::type, typename is_write_supported< typename get_pixel_type< View >::type, FormatTag >::type >::value >::type *=nullptr)
template<typename Device , typename View , typename FormatTag , typename Log >
void | write_view (Device &device, View const &view, image_write_info< FormatTag, Log > const &info, typename std::enable_if< mp11::mp_and< typename detail::is_write_device< FormatTag, Device >::type, typename is_format_tag< FormatTag >::type, typename is_write_supported< typename get_pixel_type< View >::type, FormatTag >::type >::value >::type *=nullptr)
template<typename String , typename View , typename FormatTag , typename Log >
void | write_view (String const &file_name, View const &view, image_write_info< FormatTag, Log > const &info, typename std::enable_if< mp11::mp_and< typename detail::is_supported_path_spec< String >::type, typename is_format_tag< FormatTag >::type, typename is_write_supported< typename get_pixel_type< View >::type, FormatTag >::type >::value >::type *=nullptr)
template<typename Device , typename ... Views, typename FormatTag , typename Log >
void | write_view (Device &device, any_image_view< Views... > const &views, image_write_info< FormatTag, Log > const &info, typename std::enable_if< mp11::mp_and< typename detail::is_write_device< FormatTag, Device >::type, typename is_format_tag< FormatTag >::type >::value >::type *=0)

## Detailed Description

Support for reading and writing images to file.

## Function Documentation

## ◆ read_and_convert_image()

template<typename Reader , typename Image >

void read_and_convert_image | ( | Reader & | reader,
|  | Image & | img,
|  | typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type * | = nullptr )
| inline

Reads and color-converts an image. Image memory is allocated.

Parameters

  reader | An image reader.
  img | The image in which the data is read into.
  settings | Specifies read settings depending on the image format.
  cc | Color converter function object.

Exceptions

  std::ios_base::failure |

## ◆ read_and_convert_view()

template<typename Reader , typename View >

void read_and_convert_view | ( | Reader & | reader,
|  | View const & | view,
|  | typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type * | = nullptr )
| inline

Reads and color-converts an image view. No memory is allocated.

Parameters

  reader | An image reader.
  img | The image in which the data is read into.
  settings | Specifies read settings depending on the image format.
  cc | Color converter function object.

Exceptions

  std::ios_base::failure |

## ◆ read_image()

template<typename Reader , typename Image >

void read_image | ( | Reader | reader,
|  | Image & | img,
|  | typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t >, is_read_supported< typename get_pixel_type< typename Image::view_t >::type, typename Reader::format_tag_t > >::value >::type * | = nullptr )
| inline

Reads an image without conversion. Image memory is allocated.

Parameters

  reader | An image reader.
  img | The image in which the data is read into. Must satisfy is_read_supported metafunction.

Exceptions

  std::ios_base::failure |

## ◆ read_image_info()

template<typename Device , typename FormatTag >

auto read_image_info | ( | Device & | file,
|  | image_read_settings< FormatTag > const & | settings,
|  | typename std::enable_if< mp11::mp_and< detail::is_adaptable_input_device< FormatTag, Device >, is_format_tag< FormatTag > >::value >::type * | = nullptr ) -> typename get_reader_backend<Device, FormatTag>::type
| inline

Returns the image format backend. Backend is format specific.

Parameters

  file | It's a device. Must satisfy is_adaptable_input_device metafunction.
  settings | Specifies read settings depending on the image format.

Returns
  image_read_info object dependent on the image format.

Exceptions

  std::ios_base::failure |

## ◆ read_view()

template<typename Reader , typename View >

void read_view | ( | Reader | reader,
|  | View const & | view,
|  | typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, typename is_format_tag< typename Reader::format_tag_t >::type, typename is_read_supported< typename get_pixel_type< View >::type, typename Reader::format_tag_t >::type >::value >::type * | = nullptr )
| inline

Reads an image view without conversion. No memory is allocated.

Parameters

  reader | An image reader.
  view | The image view in which the data is read into.
  settings | Specifies read settings depending on the image format.

Exceptions

  std::ios_base::failure |