Re: Problem with Image Loading - WeOnlyDo Discussion board

Re: Problem with Image Loading (General questions)

by wodSupport, Monday, May 22, 2006, 00:51 (6760 days ago) @ Maverick5

Mav,

ok, I got an idea. I couldn't personally get it to work, but I hope you'll get lucky :)

Anyway. Use MemBlob as destination. After you decrypt the image to MemBlob, do this:

1. Convert to Byte Array
2. Convert to System.IO.Stream
3. Pass that *YOUR* stream to Image.FromStream method. This fails for me - but I never used this without encryption anyway so I'm not sure how to make it work.

I don't know if it's faster way for conversions, but here's how I did it:

1. Convert to Byte Array [code] Dim d As System.Array
d = out_blob.ToArray()[/code]
2. Convert to System.IO.Stream [code] Dim s As System.IO.Stream
s = New System.IO.MemoryStream(d.Length)
Dim i As Int32
For i = 1 To d.Length
s.WriteByte(d(i))
Next[/code]
3. Pass this to Image.FromStream [code]Img = Image.FromStream(s)[/code]As I said, this doesn't work for me, but perhaps you'll know better.

Hope I helped!
Kreso


Complete thread: