using Bitmap() with file streams

  • Thread starter Thread starter todd
  • Start date Start date
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.
 
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
 
Back
Top