Blurry when EMF image converted to JPG or PNG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
pmalireddy
Posts: 6
Joined: 2012-06-08T07:55:13-07:00
Authentication code: 13

Blurry when EMF image converted to JPG or PNG

Post by pmalireddy »

Hi,

I am using 6.7.7-10-Q16 on windows to convert an EMF image to JPG. I am sorry here that I wont be able to provide the image as it needs high level permissions, which I wont be able to get.

Its not that all EMF images when converted looks blurry. Its only a particular type of image that has got the problem.
In brief the content of that image would be : a line or bar chart with some data points (text) in it. When converted to JPG/PNG, the chart as such looks fine, but the text is very blurry and bold.

This was not the case with ImageMagick 6.4.3 version though. We are moving to 6.7.7 to actually correct blurriness in text in another set of images (Tabular data EMF images). And now we have a problem with chart data image conversion with 6.7.7

Below is the command I try to convert:
convert.exe image1.emf -resize XxY -flatten image2.jpg

I also have tried other convert options like -unsharp/sharpen, -blur, -sampling-factor, -filter and it dint work.

Can someone please help me here ? I would appreciate it very much.

Thanks,
Pradeep.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Blurry when EMF image converted to JPG or PNG

Post by fmw42 »

I know little about EMF and am not a Windows user, but if it is similar to vector formats that have no size and rely upon -density, then use supersampling..

Try

convert -density 288 image.emf -resize 25% image.png

Note normal density is 72. So 72*4=288 and 25%=1/4

So we are enlarging the vector format, converting to raster and then shrinking back the the nominal size.
pmalireddy
Posts: 6
Joined: 2012-06-08T07:55:13-07:00
Authentication code: 13

Re: Blurry when EMF image converted to JPG or PNG

Post by pmalireddy »

Thanks. I tried this as well, and its still the same - the text in the image is blurry.

I have observed one other detail: when I open up the emf image in MS Paint, it looks the same as the converted jpg. Only when it is opened in other viewers like Windows Picture and Fax viewer, the text in image looks good. Seems the EMF I have is a combination of vector graphics and bitmap data. And that bitmap data is not some clear enough for imagemagick to convert fine. Does this make any sense ?
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Blurry when EMF image converted to JPG or PNG

Post by whugemann »

EMF is a vector format and text is displayed as a vector object, i.e. defined by its oulines discribed in terms of Bezier curves. If you convert this into a raster graphic, it becomes blurry, especially as the rasterisation hints in the font file are usually ingnored by generic raster processors such as ImageMagick.

I think that Fred's approach is basically correct, but text rasterised at 72 dpi will always look blurry, no matter how sophisticated you proceed, I guess. I could tell you more if you would provide a link to the original EMF.

BTW: The Metafile Companion (http://companionsoftware.com) is a good tool to analyse and modify EMF files.
Wolfgang Hugemann
Post Reply