Reputation: 704
I am converting images to EPS files with the following script.
%% Image 2 eps file.
% - img: the image.
% - eps: eps filename.
function Image2Eps(img, eps)
imshow(img,'border','tight','InitialMagnification',100);
print(gcf,'-depsc',eps);
end
The file generated almost bound the image tightly. But a small margin is always left on the top and on the right side. How to make the EPS file exactly the size of the bitmap image?
Upvotes: 3
Views: 898
Reputation: 114926
If you are not too locked on Matlab. You can use Image Magick to do the conversion. I used it in a command line:
imgtops2.exe imge.ppm -e -c 0,0 -o image.eps
I used it on a Windows machine, but I believe they have working binaries for other OS as well.
Furthermore, once you have a working command line in dos
or shell
you can call it from Matlab using system
, dos
or unix
commands.
PS.
I used an old version of ImageMagick, in more recent releases they might have changed imgtops2
to convert
, you'll have to look at their documentation.
Upvotes: 0