How can I eliminate the jagged edges present in fonts within images?

조회 수: 4 (최근 30일)
HC
HC 2025년 9월 8일
답변: Image Analyst 2025년 9월 8일
In images generated by MATLAB in EMF format, fonts exhibit noticeable jagged edges, whereas this issue does not occur in PNG format.
How can I eliminate the jagged edges present in fonts within images in EMF format?
  댓글 수: 5
DGM
DGM 2025년 9월 8일
편집: DGM 2025년 9월 8일
EMF is a windows thing, so I can't test the behavior of the encoder, and I'm not familiar with how text would typically be handled. That said, EMF is like other "vector" formats in that it can accept embedded raster objects. It appears that the text (and some of the other plot objects) are embedded as non-aa raster images.
That might be a consequence of how the images/objects are stored. As far as I know, EMF only supports 1-bit transparency, not linear opacity (alpha). If the text is treated as having transparent background color (for compositing purposes), then I would expect that it must have jagged edges owing to the 1-bit transparency. Under that assumption, the only way that smoothed raster text could be embedded would be if it were matted with a solid color to match whatever it's occluding in the stack. Without greatly complicating things, presuming a matting color would cause other problems with accurate composition.
... at least that's my guess. As to whether there's a better choice, I can't say. I'm running an old enough version that I know some of the figure capture behaviors have changed in the interim. I'd probably just add to the confusion if I tried to explore what "sort of works for me" in legacy versions in a different environment. Best I could do is ask if you've considered trying exportgraphics() or export_fig() (on the FEX). They may behave differently or at least offer a wider range of format options than print().
HC
HC 2025년 9월 8일
Thank you for your detailed feedback.
I tested the exportgraphics() function, but it didn't work. As another vector graphics supported by Office Word, SVG graphics do not encounter this issue compared to the EMF format. Both exportgraphics() and print() functions support the SVG vector graphics.

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

답변 (1개)

Image Analyst
Image Analyst 2025년 9월 8일
If exportgraphics didn't fix it, try export_fig

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by