Click to See Complete Forum and Search --> : Bitmap to Metafile problem


gayathri_gopi
06-23-2004, 03:26 AM
//dlg1.Filename is a metafile

Metafile mf=new Metafile(dlg1.FileName,ipHdc);
ImageFormat[] aif = { ImageFormat.Bmp, ImageFormat.Gif,ImageFormat.Emf, ImageFormat.Jpeg, ImageFormat.Png, ImageFormat.Tiff };
grfx.ReleaseHdc(ipHdc);
grfx = Graphics.FromImage(mf);
grfx.DrawImage(bm, 0, 0, cx, cy);
grfx.Dispose();
try
{
mf.Save(dlg1.FileName,aif[2]);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Text);
}


In this program of converting a bitmap to a metafile,the above code creates a metafile before using the mf.save line.
But the size of metafile is larger than the original bmp.

The mf.Save method creates a metafile but,with some exception,
"A generic error occured in GDI+".
while displaying the type of that file using GetType(), it returns bitmap.

I need to know first, whether a metafile is lesser in size than a bitmap.

if so, how can i convert a bitmap to a metafile?
My program , till before the line mf.save(....), creates metafile with
a size larger than the bitmap i specified.

So any body, please help em out.

ap.net
06-22-2006, 04:59 AM
Hi,

I know it's a bit late to react, but I have the same problem you discribed. I was hoping that you have solved the problem by now.

I just want to create a Metafile in memory, draw something and then save it to a file, but is still get the error message GI+ error.....


Thanks in Advance!

Regards,


Ap