Convert wmf to jpeg causes black background in result image.

Discussion in 'ASP .Net' started by Jonas, Aug 12, 2005.

  1. Jonas

    Jonas Guest

    Hi!

    When i use the code below to convert a wmf to a jpg image, the output will
    always be with a black backgound.

    ("data" is a byte array containing the WMF file)

    System.IO.MemoryStream ms = new MemoryStream(data,0,data.Length);
    ms.Write(data,0,data.Length);
    ms.Position = 0;

    System.Drawing.Image img = System.Drawing.Image.FromStream( ms );

    this.Response.Clear();
    this.Response.ContentType = "image/jpg";
    img.Save(this.Response.OutputStream,
    System.Drawing.Imaging.ImageFormat.Jpeg);

    Does anyone have a solution?

    /Jonas
     
    Jonas, Aug 12, 2005
    #1
    1. Advertising

  2. Same happens to transparent gifs there is some code that does the job for
    gifs maybe it works for your issue too.
    I wrote an article (but its german):

    http://www.newtelligence.net/content/binary/Articles/DNP-Articles/2005-03/dnp0305_Thumbnail.pdf

    --
    Daniel Fisher(lennybacon)


    "Jonas" <jonas_nilsson[AT]hotmail.com> wrote in message
    news:...
    > Hi!
    >
    > When i use the code below to convert a wmf to a jpg image, the output will
    > always be with a black backgound.
    >
    > ("data" is a byte array containing the WMF file)
    >
    > System.IO.MemoryStream ms = new MemoryStream(data,0,data.Length);
    > ms.Write(data,0,data.Length);
    > ms.Position = 0;
    >
    > System.Drawing.Image img = System.Drawing.Image.FromStream( ms );
    >
    > this.Response.Clear();
    > this.Response.ContentType = "image/jpg";
    > img.Save(this.Response.OutputStream,
    > System.Drawing.Imaging.ImageFormat.Jpeg);
    >
    > Does anyone have a solution?
    >
    > /Jonas
    >
     
    Daniel Fisher\(lennybacon\), Aug 12, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ganesh Palaniappan

    SVG-WMF or PNG-WMF conversion

    Ganesh Palaniappan, Apr 10, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,296
    =?ISO-8859-15?Q?Lo=EFc_Carr=E8re?=
    Apr 13, 2006
  2. Greg
    Replies:
    4
    Views:
    1,206
  3. lovaspillando
    Replies:
    0
    Views:
    1,064
    lovaspillando
    Aug 26, 2007
  4. Michael Tan
    Replies:
    32
    Views:
    1,075
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page