Take A Snapshot In Maya

// keep the old format
int    $format    =    `getAttr "defaultRenderGlobals.imageFormat"`;
// set to render to .png image
setAttr    "defaultRenderGlobals.imageFormat" 32;
// playblast one frame to a specific file
playblast    -frame 1    -format    "image"    -cf    "D:/foo.png" -v 0    -wh    240    175    -p 100;
// restore the old format
setAttr    "defaultRenderGlobals.imageFormat" $format;

Above is a chunk of MEL will take a snapshot of what’s inside active view port and save to a .png image file to disk. Could be useful when you want to save a thumbnail of the scene.

Advertisements

Leave a comment

Filed under MEL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s