Задайте вопросЗадайте вопрос
 

ОтвеченоConvert WMF to JPG

Ответы

  • 21 августа 2006 г. 19:37Brendan GrantМодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено

    If I recall correctly, WMF files do not store a background color which causes them to be transparent and when you convert it as we did previously, the color ends up being no color at all (ie black).

    In order to fix that we need to do a little more, namely create a new image, set it's background color and then paint the WMF file on top of it.

                Image i = Image.FromFile("SomeFile.wmf", true);

               

                Bitmap b = new Bitmap(i);

               

                Graphics g = Graphics.FromImage(b);

               

                g.Clear(Color.White);

               

                g.DrawImage(i, 0, 0, i.Width, i.Height);

               

                b.Save("C:\OutputFile.jpg", ImageFormat.Jpeg);

Все ответы