Render and save " view port render image (openGL)" with python directly? Hi I made one add on which can save and load custom props (drive shape keys) and pose bone transform for Armature characters as preset.json with some options.
Then I hope to enhance it which will generate preview image(jpg, or png) with json.
(eg When I save &quot;preset.json&quot; from add on UI button,it will auto generate preset.png of current scene preview)
I suppose I can use this module,,  bpy.utils submodule (bpy.utils.previews)
but do not know clear, how actually it work. What I hope to know is, function whici may generate preview with path which user decided.
I suspect I can mix the funciton with my custom operator class to save json..(so when save the json, same name image file will be genrated as perview)
If someone experience same thing, would you teach me how you achive it(with simple code)?
I suppose I may need to use the bpy.utils.submodule(bpy.utils.previews) but even though I read doc and example (which use the image as UI widgt, but I need not, I only need to know how generate current scene preview as image file)
//////
Though my final goal is same, but I now get some steps, then change tittle..
what I planned is,

render and save view port open GL image with current user scene setting, when save preset.json from my add on UI button

Then I hope to make render and save function, which render view port(Open GL) image and save the image &quot;without image editor&gt;render-image&gt;save&quot;
I plan to use bpy.ops.render.opengl(), to render sumbnail , is there good way,
&quot;without open image editor(Render image) and choose slots&quot; but save to the directory with file name, as arguments?
Have someone alrady made simillar (simple) custom funciton ?
It was actually easy. thanks there is already arguments, to direct output render-image in bpy.ops.render.opengl()  (write_still = &quot;True&quot;)
then most simple case (if keep current scene render setting), once change path(file name) to render thumbnail(openGL view image), then after generate the img , return path as same as before. (so user may not notice it changed)
import bpy

def render_icons(fname):
    render = bpy.context.scene.render
    upath = render.filepath
    render.filepath = fname
    bpy.ops.render.opengl(animation=False, view_context=False, write_still=True)
    bpy.context.scene.render.filepath = upath

I suppose, to enhance this, untill render, set some render propertys of bpy.context.scene.render to fit as thumbnail, then return all property as same as before.
and add option flag (user may manually set those setting, or use preset for icon render)