I have figured out a solution. The steps are as the following, the core file
for the solution lies in OutputStream::writeImage function.
1. To write a image (e.g., *.jpg) inside a file, we need the WRITE_INLINE_FILE
mode, which is set by
osgDB::writeNodeFile(*node, "out.osgb", &options);
2. The image has to be first write to disk and a proper search path is needed.
A node visitor will do the image write correctly and the search path is set by
Read this topic online here:
osg-users mailing list