Quantcast
Channel: mel wiki
Viewing all articles
Browse latest Browse all 610

API: How can I get a screen-shot of the active view?

$
0
0
Wow, so easy:
# Python code
import maya.OpenMaya as om
import maya.OpenMayaUI as omui

fileType = 'jpg'
imageFile = 'c:/temp/mayaScreen.%s'%fileType
mimage = om.MImage()
view = omui.M3dView.active3dView()
view.readColorBuffer(mimage, True)
mimage.writeToFile(imageFile, fileType)
From the MImage docs, these image formats are supported for output:
  • iff, sgi, pic, tif, als, gif, rla, jpg
Docs:

Viewing all articles
Browse latest Browse all 610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>