I have an EMF file. I want to resize it smaller.
How to do it in .net (or with any tool) without getting a blurry image ?
The resulting modified image will be converted to another format (png / jpg / whatever), I can handle this (I think).
I did not find a clear example in .Net (or any language platform for this question) that deals with emf / metafiles.
I looked at graphical programming using GDI +, but it only enters metafiles.
I tried Image Magick, but you need to convert it to a different format (which I need to do anyway) and the result will be blurry (e.g. compressed and converted to png).
I tried Inkscape, but you can only import the EMF file, and Inkscape imports it upside down and out of proportion to an existing drawing.
Also, (donβt laugh) I opened it in Window Paint (one of the few image editing programs that will open emf) and resize the drawing, again blurred.
Update: Here is the code I'm using to resize.
This works, but the resulting image is blurry. Code is just a normal non-EMF image redefinition procedure
private static Image resizeImage(Image imgToResize, Size size) { int sourceWidth = imgToResize.Width; int sourceHeight = imgToResize.Height; float nPercent = 0; float nPercentW = 0; float nPercentH = 0; nPercentW = ((float)size.Width / (float)sourceWidth); nPercentH = ((float)size.Height / (float)sourceHeight); if (nPercentH < nPercentW) nPercent = nPercentH; else nPercent = nPercentW; int destWidth = (int)(sourceWidth * nPercent); int destHeight = (int)(sourceHeight * nPercent); Bitmap b = new Bitmap(destWidth, destHeight); Graphics g = Graphics.FromImage((Image)b); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(imgToResize, 0, 0, destWidth, destHeight); g.Dispose(); return (Image)b; }
Source: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing