scrambled output from mlab.savefig()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

scrambled output from mlab.savefig()

Roan LaPlante
When mlab.savefig is given a magnification argument, the output tends to be scrambled, with the full size image replacing the first box and the last box absent.  The following code, for instance, seems to produce output of the type much like the attached (for any value of magnification > 1)

def _save_button_fired(self):
    mlab.savefig('/autofs/homes/005/rlaplant/testres.png',magnification=self.image_magnify)

Scanning the mailing list, this issue appears to be years old but I haven't been able to find any sign of a fix.


thanks,
R


--
Roan LaPlante
Athinoula A. Martinos Center for Biomedical Imaging


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

testres.png (2M) Download Attachment
testres2.png (1M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: scrambled output from mlab.savefig()

Roan LaPlante
I did some digging and believe I have tracked down this bug to the following trait in tvtk.WindowToImageFilter

   read_front_buffer = tvtk_base.true_bool_trait(help=\
        """
        Set/Get the flag that determines which buffer to read from.
        The default is to read from the front buffer.   
        """

In tvtk_scene.save_$fmt(), the filter is called with read_front_buffer=False, overriding the default value.  Setting it to true fixes the bug.

I am a little worried that the original function overwrote the default value, which suggests there may have been a good reason, and I don't really have any idea whats going on under the vtk hood.  I am not able to test it thoroughly, at least not for a little while because our network filesystem is in a severe state of disrepair right now.

R

On Fri, Feb 15, 2013 at 10:17 AM, Roan LaPlante <[hidden email]> wrote:
When mlab.savefig is given a magnification argument, the output tends to be scrambled, with the full size image replacing the first box and the last box absent.  The following code, for instance, seems to produce output of the type much like the attached (for any value of magnification > 1)

def _save_button_fired(self):
    mlab.savefig('/autofs/homes/005/rlaplant/testres.png',magnification=self.image_magnify)

Scanning the mailing list, this issue appears to be years old but I haven't been able to find any sign of a fix.


thanks,
R


--
Roan LaPlante
Athinoula A. Martinos Center for Biomedical Imaging




--
Roan LaPlante
Athinoula A. Martinos Center for Biomedical Imaging


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev