Save Matlab myaa image to png file

Alec Jacobson

June 27, 2012

weblog/

I use the myaa (My Anti Aliasing) tool frequently to create nice camera-ready graphics directly in matlab. Often I'll just take screen captures, but when scripting it's nice to save procedurally. Now I do this by calling:
drawnow
imwrite(getfield(getframe(gca),'cdata'),'myaa.png')
Unless I'm unaware of something, saving to an image file is not directly supported in myaa. Update: Awkwardly this is not so good for scripting because getframe seems to take a screengrab rather than a buffer dump. Update: Try also:
imwrite(hardcopy(gca, '-Dzbuffer', '-r0'),'myaa.png');