ImFusion SDK 4.3
PngIO Class Reference

Static Public Member Functions

static std::unique_ptr< MemImagereadImage (const Filesystem::Path &filename, std::map< std::string, std::string > *outTextChunks=nullptr)
 Load a PNG image from the filesystem.
 
static std::unique_ptr< MemImagereadImage (ByteBufferView buffer, std::map< std::string, std::string > *outTextChunks=nullptr)
 Load a PNG image from a ByteBuffer.
 
static bool writeImage (const Filesystem::Path &filename, const MemImage &image, int compression=3)
 Save a PNG image to the filesystem.
 
static std::unique_ptr< ByteBufferwriteImage (const MemImage &image, int compression=3)
 Save a PNG image to a ByteBuffer.
 

Member Function Documentation

◆ readImage() [1/2]

static std::unique_ptr< MemImage > readImage ( const Filesystem::Path & filename,
std::map< std::string, std::string > * outTextChunks = nullptr )
static

Load a PNG image from the filesystem.

Will return a nullptr on error.

Parameters
filenamePath to the PNG file on the local filesystem to load from.
outTextChunksOptional output parameter to store key-value text chunks present in the PNG file.

◆ readImage() [2/2]

static std::unique_ptr< MemImage > readImage ( ByteBufferView buffer,
std::map< std::string, std::string > * outTextChunks = nullptr )
static

Load a PNG image from a ByteBuffer.

Will return a nullptr on error.

Parameters
bufferMemory buffer containing a valid PNG file structure to load from.
outTextChunksOptional output parameter to store key-value text chunks present in the PNG file.

◆ writeImage() [1/2]

static bool writeImage ( const Filesystem::Path & filename,
const MemImage & image,
int compression = 3 )
static

Save a PNG image to the filesystem.

Note: If the type of image is Image::FLOAT or image.shift() != 0.0 or its image.scale() != 1.0, image will be normalized using ImageProcessing::Normalization::ValueRange before it is converted to PNG. Otherwise, no normalization is performed.

Parameters
filenamePath to the PNG file on the local filesystem to be created.
imageImage to save
compressionCompression level. Valid values range from 0-9, corresponding directly to the zlib compression levels (0 - no compression, 9 - "maximal" compression).
Returns
Whether the operation was successful

◆ writeImage() [2/2]

static std::unique_ptr< ByteBuffer > writeImage ( const MemImage & image,
int compression = 3 )
static

Save a PNG image to a ByteBuffer.

Note: If the type of image is Image::FLOAT or image.shift()!=0.0 or its image.scale()!=1.0, image will be normalized using ImageProcessing::Normalization::ValueRange before it is converted to PNG. Otherwise, no normalization is performed.

Parameters
imageImage to save
compressionCompression level. Valid values range from 0-9, corresponding directly to the zlib compression levels (0 - no compression, 9 - "maximal" compression).
Returns
nullptr on error

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close