| // Copyright 2023 Google LLC | |
| // SPDX-License-Identifier: BSD-2-Clause | |
| #ifndef LIBAVIF_APPS_AVIFGAINMAPUTIL_IMAGEIO_H_ | |
| #define LIBAVIF_APPS_AVIFGAINMAPUTIL_IMAGEIO_H_ | |
| #include <string> | |
| #include "avif/avif.h" | |
| namespace avif { | |
| // Writes an image in any of the supported formats based on the file extension. | |
| // Grid images are supported by Avif only, grid_cols/grid_rows is ignored for | |
| // other formats. | |
| avifResult WriteImage(const avifImage* image, int grid_cols, int grid_rows, | |
| const std::string& output_filename, int quality, | |
| int speed, int jobs); | |
| // Reads an image in any of the supported formats. Ignores any gain map. | |
| avifResult ReadImage(avifImage* image, const std::string& input_filename, | |
| avifPixelFormat requested_format, uint32_t requested_depth, | |
| bool ignore_profile, bool ignore_exif, bool ignore_xmp, | |
| bool ignore_alpha, bool ignore_gain_map, int jobs); | |
| // Writes an image in avif format given a pre-configured encoder. | |
| avifResult WriteAvif(const avifImage* image, avifEncoder* encoder, | |
| const std::string& output_filename); | |
| // If grid_cols*grid_rows > 1, splits 'image' into a grid and writes it to an | |
| // AVIF file. Otherwise, just writes a single AVIF image. | |
| avifResult WriteAvifGrid(const avifImage* image, int grid_cols, int grid_rows, | |
| avifEncoder* encoder, const std::string& filename); | |
| // Reads an image in avif format given a pre-configured decoder. | |
| // The image can be accessed at decoder->image. | |
| avifResult ReadAvif(avifDecoder* decoder, const std::string& input_filename); | |
| } // namespace avif | |
| #endif // LIBAVIF_APPS_AVIFGAINMAPUTIL_IMAGEIO_H_ |