using Bitmap() with file streams

T

todd

hi,

I'm having some trouble grabbing a bitmap image from the
middle of a file. My file currently has the encodings for
a jpeg image somewhere within a given file. I'd like to
just use Bitmap bmp = new Bitmap( .. ) on the given
portion, as .NET CF already provides a way to decode
jpegs. Can someone help nudge me in the right direction?
thanks.

Todd

P.S: I've tried creating a separate stream or using the
filestream, but my attempts were unsuccessful.
 
A

Alex Feinman [MVP]

Read the appropriate part of your file into a new MemoryStream using
FileStream. Then feed MemoryStream to a bitmap constructor. This will work
provided that your source file contains a complete jpeg stream (as in a
standalone jpg file), which you can locate and read from it
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top