Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Convert wmf to jpeg causes black background in result image.

 
Thread Tools Search this Thread
Old 08-12-2005, 01:49 PM   #1
Default Convert wmf to jpeg causes black background in result image.


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
  Reply With Quote
Old 08-12-2005, 03:20 PM   #2
Daniel Fisher\(lennybacon\)
 
Posts: n/a
Default Re: Convert wmf to jpeg causes black background in result image.

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..._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
>



  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump