How to read two PNG file and convert them to SharedImageSet? (SDK)

What is the correct way to read PNG files and convert them to SharedImageSet?

Currently I’m using PngIO::readImage save it to a MemImage then converting it to TypedImage then convert to SharedImages and then finally put it into a SharedImageSet. Then when I try to visualize the SharedImageSet I get two grey blanks. Is there a more straight forward and correct way to read PNG files?

For context I’m working with ImFusion SDK 3.2

You can create the SharedImageSet directly from the MemImage:

std::unique_ptr<MemImage> mem = PngIO::readImage(path);
SharedImageSet sis(std::move(mem));

or even

SharedImageSet sis(PngIO::readImage(path));

Alternatively you can use the FileLoader class that can load all kinds of files:

FileLoader loader;
auto result = loader.load(path);
if (result)
    std::unique_ptr<SharedImageSet> image = result->extractFirstImage();
1 Like