Sign in to follow this  
Scet

[.net] [solved] Problem loading Bitmaps from Stream

Recommended Posts

Scet    960
Hello, I'm working a file format that for now consists of several Bitmap objects all saved to the same file. I'm simply saving them using Bitmap.Save( Stream, Format ), where Stream is a FileStream and Format is ImageFormat.Bmp. I even checked the stream position before loading and it is indeed correct. However I keep getting System.ArgumentException. I did a little experiment and found that when just saving one image and nothing else, it works. However when adding the header it throws the exception, and yes I did read past the header to the start of the image data. So I'm lead to believe that this Bitmap constructor resets the stream position to 0. Does anyone have any idea why it's acting this way? I need to figure this out or I'll have to output pixel by pixel which really sucks. Thank you for any help. Edit: Nevermind, I've figured out a solution of just saving/loading the Bitmap to a MemoryStream and then saving/loading the MemoryStream. [Edited by - Scet on August 20, 2006 5:58:40 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this