Yeah, that works, because it's writing the image out as a Uchar, not a 
kFloat.  That seems to always work no matter what, but its the writing 
images with float values that don't work.

On Thursday, November 15, 2012 3:09:26 AM UTC-8, san wrote:
>
> This method works for me
> import maya.OpenMaya as api
> import maya.OpenMayaUI as apiUI
>
>                        view = apiUI.M3dView.active3dView()
>                        #read the color buffer from the view, and save the 
> MImage to disk
>                        image = api.MImage()
>                        view.readColorBuffer(image, True)
>                        image.writeToFile(filename, 'jpg')
>
> this should work for you too!!!
>
>
> On Thursday, November 15, 2012 11:25:51 AM UTC+5:30, Daniel Lindsey wrote:
>>
>> I have tried multiple ways of doing this including
>> myImage = om.MImage()
>> myImage.readFromFile(filename, om.MImage.kFloat)
>> myImage.writeToFile(outFilename, "tif")
>>
>> as well as
>>
>> myImage.readFromFile(filename, om.MImage.kFloat)
>> pixels = myImage.floatPixels()
>> outImage = om.MImage()
>> outImage.create(width, height, 4, om.MImage.kFloat)
>> outImage.setFloatPixels(pixels, width, height)
>> outImage.writeToFile(outFilename, "tif")
>>
>>
>> On Wednesday, November 14, 2012 3:47:10 PM UTC-8, Daniel Lindsey wrote:
>>>
>>> every time I try this with the python api, I get a kFailure, internal 
>>> error.  Has anyone been able to successfully write using MIMage?  BTW, 
>>> I apologize ahead of time if multiples of this subject show up.  I have 
>>> been trying to post for the past few days, and the groups says it posts, 
>>> but it never seems to actually get posted.
>>>
>>> Thanks,
>>>
>>> D
>>>
>>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to