Search code examples
matlabmatlab-figure

How to export non-blurry eps images?


I'm exporting an image in Matlab using the eps format, but it smooths the image. Matlab does not blur the image using other formats such as png. I would like to know how to export a non-blurry image with eps format. Here is the resulting image using png: enter image description here

And here is the resulting image using eps: enter image description here


Solution

  • UPDATE:

    The problem is reproducible on a Mac, and the issue is with the eps renderer rather than MATLAB. For e.g., saving imagesc(rand(20)) and viewing with Preview and GSview results in the following:

    Preview screenshot

    enter image description here

    GSview screenshot

    enter image description here

    Clearly, the information is not lost. It is just not interpreted/read correctly by some EPS viewers. The solution is simple: use GSview to view your eps images. You can download it from here

    On Macs especially, if your end application is latex/pdflatex, you will have to explicitly set it to use GS/GSview, because otherwise, it will default to the Quartz engine, which is baked into the OS.


    PREVIOUS ANSWER:

    I am unable to reproduce the behavior your described. Here is the code I used, tested using R2010b on WinXP 32-bit:

    M = fspecial('gaussian',[20 20],5);
    imagesc(M)
    print('-dpng','a.png')
    print('-depsc2','b.eps')
    

    a.png

    a.png

    b.eps

    b.eps

    Perhaps this is an issue with your EPS viewer...