Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap.FromStream hangs #15

Closed
buraktamturk opened this issue May 15, 2015 · 3 comments
Closed

Bitmap.FromStream hangs #15

buraktamturk opened this issue May 15, 2015 · 3 comments

Comments

@buraktamturk
Copy link

Hello,

I want to create Bitmap from MemoryStream. But whatever i use from FileStream or MemoryStream, I got hang after calling Bitmap.FromStream.

MemoryStream ms = new MemoryStream();
new FileStream("/Users/buraktamturk/test.jpg", FileMode.Open).CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);

Bitmap b = (Bitmap)Bitmap.FromStream(ms);

OS: OS X
Runtime: mono or dnvm (whichever is right)

I think I have a problem with integration, cause when i try it on Windows. I get following exception instead of hang.

BitmapImage has not been initialized.  Call the BeginInit method, set the appropriate properties, and then call the EndInit method.

Thanks,
Burak

Edit: Not only MemoryStream, but also FileStream.

@anders9ustafsson
Copy link
Contributor

Thanks for reporting, Burak!
Which platform are you targeting, iOS?
I don't recognize the error message right away, but I will look deeper into the issue within the next few days.
Best regards,
Anders @ Cureos

@buraktamturk
Copy link
Author

Thank you, actually I am targetting vnext web project Windows for production, OS X for development. (web application) The runtime is dnvm runtime but i belive it uses mono on OS X because it needs mono to run. in os x the function hangs, in windows i get the exception message "BitmapImage has not been initialized."

You do not have to look at this issue because I managed to import System.Drawing to that project at least on Windows, so my code is working at least on Windows and i can use virtual machine while i am developing. Thanks again!

@anders9ustafsson
Copy link
Contributor

If you are working with ASP.NET, it is probably better to use the original AForge libraries, where you (at least on Windows) should have access to the real System.Drawing assembly. I am no Mono expert, but isn't there System.Drawing for Mono, too? If you use the original libraries (see here), I think you should be able to work it out even on Mac OS X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants