OpenMaya 2.0 - saving thumbnail

Hi, I’m looking for help with OpenMaya 2.0, I am trying to save a picture of my viewport in 1920x1080, but when I take the picture with this script, it export the image in the good dimension but the thumbnail is not adapted for the format.

The script :

import maya.api.OpenMaya as om
import maya.api.OpenMayaUI as omUI

image = om.MImage()
image.create(1920, 1080)

view = omUI.M3dView.active3dView()
view.pushViewport(0, 0, 1920, 1080)
view.readColorBuffer(image, True)


image.writeToFile(“C:\tmp\test.jpeg”, outputFormat=“jpeg” )

My maya :

The result :

If anyone know how to fix this problem, they are welcome

Thank you !

Hmm it seems you are screenshotting the 3d view but you are setting a hard resolution value that shoots over your minimized viewport. Perhaps you can try querying the view’s current height/width?

view.pushViewport(0, 0, view.portWidth(), view.portHeight())