[Closed] Rendered Frame Window – Image access
Hi all,
do any of you know, if it’s possible to get hold of the displayed image in a Rendered Frame Window to save it programmatically?
Background to this is that I wrote a batchtool that starts Octane renderings in it’s live viewport and ports them to the max framebuffer after a set amount of time. Unfortunately we’re in the middle of a larger production cycle and currently forced to use a version of Octane that only has very restricted Maxscript access (renderer can’t be accessed – I’m using window handles).
I’m now stuck with the Rendered Frame Window containing the resulting image but haven’t been able to find a way to store the image. Accessing the save button opens up the “Save File” dialog and blocks further maxscript execution. getLastRenderedImage() returns “undefined” because I’m using the OctaneRender viewport and only porting the resulting image to the 3dsmax framebuffer.
Possibly using callbacks such as #preImageViewerDisplay ?
Thanks in advance!
fn getVFBbuttons = (
if ((maxVersion())[1] < 9000) then ( return -1 )
myDialogs = UIAccessor.getChildWindows 0
maxVFB = undefined
for dlg in myDialogs do (
dialogTitle = UIAccessor.getWindowText dlg
if (matchpattern dialogTitle pattern:"*, frame * (*:*)") then (
maxVFB = dlg
exit
)
)
if (maxVFB == undefined) then ( return -2 )
VFB_children = UIAccessor.getChildWindows maxVFB
VFB_children = for b in VFB_children where (UIAccessor.GetWindowClassName b) == "CustButton" collect b
)
fn getVFBbitmap ptrs = (
uiaccessor.pressbutton ptrs[2]
getclipboardBitmap()
)
bm = getVFBbitmap (getVFBbuttons())
-- bm.filename = %your_image_path%
if bm.filename != "" then save bm
display bm
You can copy vfb image to clipboard, but it will be clamped to 8bit per channel and no alpha
ps. hmm… as an idea. what if you render 1px*1px region and then save image?
And it will be at whatever zoom level is displayed, e.g. if you’re viewing a 4000×3000 image at 25%, you’ll get a 1000×750 image in the clipboard.
Will give that a try thanks! Resolution and lack of 32bit will probably be an issue, but it’s something to start with
would it be OK for you if we set the file name and press the “Save” button? there are couple examples on this forum how to do it.
Sounds great. Seems as though I probably didn’t search the forum here thoroughly enough or I was using the wrong search terms