Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlab.savefig saves wrong resolution (for first two images in loop) #1288

Open
smiet opened this issue Jan 17, 2024 · 0 comments
Open

mlab.savefig saves wrong resolution (for first two images in loop) #1288

smiet opened this issue Jan 17, 2024 · 0 comments

Comments

@smiet
Copy link

smiet commented Jan 17, 2024

When using mlab.savefig(<imagename>, size=(x, y)) the resolution of the saved image is about 10x that specified:

from mayavi import mlab

f = mlab.figure()
mlab.test_plot3d()
mlab.savefig('savetest.png', size=(100,80))

resolution:

$ identify -format '%f %w x %h \n' savetest.png 
savetest.png 1200 x 891 

When using mlab.savefig() in a for loop to generate a series of images, the first two will have this wrong resolution, the rest will be correct.
MWE:

from mayavi import mlab

f = mlab.figure()
for n in range(10):
    mlab.test_contour3d()
    mlab.draw()
    mlab.savefig(f'iteration_{n}.png', size=(100, 80))
    mlab.clf()

The resolutions are (assuming ImageMagick is installed)

$ identify -format '%f %w x %h \n' iteration_*
iteration_0.png 1200 x 891 
iteration_1.png 1200 x 891 
iteration_2.png 99 x 78 
iteration_3.png 99 x 78 
iteration_4.png 99 x 78 
iteration_5.png 99 x 78 
iteration_6.png 99 x 78 
iteration_7.png 99 x 78 
iteration_8.png 99 x 78 
iteration_9.png 99 x 78 

This also occurs when using the virtual frame buffer http://docs.enthought.com/mayavi/mayavi/tips.html#rendering-using-the-virtual-framebuffer.

when using the direct frame buffer, I see the rendering process uses the whole window, and switches to a much smaller section after the third image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant