Is there an efficient way to convert images to vector images like .eps, .ai, etc.?

조회 수: 10 (최근 30일)
Is there any way to create a vector image from a jpeg, png, etc.? I can convert images to binary contours, but that is about as far as I got. I am getting stuck on tracing the contour then exporting the data to an eps file.
Thank you in advance for any suggestions!

채택된 답변

Walter Roberson
Walter Roberson 2013년 2월 23일
편집: Image Analyst 2023년 2월 20일
I recommend that you use the MATLAB File Exchange contribution export_fig which is more likely to get the result correct than using the normal routines.

추가 답변 (3개)

Image Analyst
Image Analyst 2013년 2월 23일
You can type "imformats" on the command line to see what imwrite() supports. If it's not there, then you're going to have to look for a custom file writer to do the job. You can look in the File Exchange.

Jan
Jan 2013년 2월 24일
편집: Jan 2023년 2월 20일
As far as I understand, you have a file in pixel format and want to vectorize it. This is neither a problem for IMWRITE nor for EXPORT_FIG, but the problem is the division of the pixel image into areas.
  댓글 수: 3
DGM
DGM 2023년 2월 20일
The exported svg will contain vector objects where possible (e.g. the figure background, line objects, titles, labels, ticks), but raster cdata displayed with imshow()/image() are simply embedded as raster images.
That might allow something which has full SVG support to read the file, but it doesn't actually vectorize the raster content.
% a super-simple image
inpict = zeros(100);
inpict(25:75,25:75) = 1;
imagesc(inpict)
% export to svg
set(gcf,'renderer','painters');
export_fig 'testme.svg'
If I'm doing this wrong, I'm open to suggestions. Export_fig() is like a swiss army knife with just enough blades to make you doubt you're using the right one.
Jan
Jan 2023년 2월 20일
@DGM: You hit the point. export_fig does not vectorize raster images. This is a job for an external tool line InkScape (free), PhotoShop or Corel Painter.

댓글을 달려면 로그인하십시오.


Richard McCulloch
Richard McCulloch 2013년 6월 27일
Walter's answer led me to my optimal result:
saveas(gcf,'Name','ai')
This format looks like it is going to be discontinued in further releases (I'm on 2012b) so the suggested solution is:
saveas(gcf,'Name.eps')
which works, but then has to be converted to ai for my particular application. Thank you all for your answers. Sorry I can only accept one, you all helped. :)
Richard

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by