MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ save_image() [3/4]

bool MayaFlux::IO::IOManager::save_image ( const std::shared_ptr< Core::VKImage > &  image,
const std::string &  filepath,
const IO::ImageWriteOptions &  options = {} 
)

Save image data to disk asynchronously.

The source is downloaded from the GPU on the calling thread (must have command queue access) and the encode + disk flush is dispatched to a worker. Returns once the download completes and the encode task is queued; encode/flush failures are logged but do not block the caller.

For synchronous semantics (e.g. shutdown flush, tests) use the IO::save_image / IO::save_texture_buffer free functions in ImageExport.hpp.

The extension of filepath selects the writer via ImageWriterRegistry. Format-variant compatibility is the writer's responsibility (PNG wants uint8, EXR wants float, etc.).

Returns
True if the download succeeded and the encode task was queued.

Definition at line 1206 of file IOManager.cpp.

1210{
1211 if (!image) {
1213 "save_image: null image");
1214 return false;
1215 }
1216
1217 track_save_task(std::async(std::launch::async,
1218 [image, filepath, options]() -> bool {
1219 auto data = IO::download_image(image);
1220 if (!data) {
1222 "save_image task: download failed for '{}'", filepath);
1223 return false;
1224 }
1225
1226 return Detail::execute_image_write(filepath, *data, options);
1227 }));
1228
1229 return true;
1230}
#define MF_ERROR(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:47
void track_save_task(std::future< bool > fut)
Retain a save task in m_save_tasks and opportunistically reclaim finished ones.
bool execute_image_write(const std::string &filepath, const ImageData &data, const ImageWriteOptions &options)
std::optional< ImageData > download_image(const std::shared_ptr< Core::VKImage > &image)
Download pixel data from a GPU-resident VKImage into host ImageData.
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::IO::download_image(), MayaFlux::IO::Detail::execute_image_write(), MayaFlux::Journal::FileIO, image, MayaFlux::Journal::IO, MF_ERROR, and track_save_task().

Referenced by save_image(), and save_image().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: