Re: Loading image byte array
- From: "Frank Hileman" <frankhil@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 1 Feb 2007 15:34:59 -0800
Load it first into a Bitmap as usual. You will know the width and height at
that point Then create a Graphics using a fast-access second bitmap (we call
it EffectBuffer), and render into that second bitmap using
DrawImageUnscaled. Dispose the first Bitmap.
Also I just posted some more information on the fast access technique in the
original thread.
Regards,
Frank Hileman
check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor
"Andreas" <dont.need@xxxxxxx> wrote in message
news:uS3VgSURHHA.4404@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I recently found a thread where Frank Hileman suggested using the Bitmap
overload that enables you to get direct access to the image byte-array,
opposed to using unsafe code along with lockbits. I've written a small
wrapper for this functionality and its working ok. My question is, how
would I load an image from a file into this byte array? Obviously using
the Bitmap.FromFile() it out of the question since I dont want an extra
bitmap object in memory and besides it would require me to transfer pixel
by pixel over to the byte array.
So does anyone have any suggestions on how to do this, while (preferbly)
keep the ability to load various formats (I will settle for the onces that
Bitmap.FromFile can handle for now)? Speed is also a factor I would like
to increase as much as possible. It would require me to get the image
dimentions as well so I can initilize the correct byte array, get a known
stide size and so on.. you get the picture (no phun intended) =)
Thanks!
Andreas
.
- Follow-Ups:
- Re: Loading image byte array
- From: Andreas
- Re: Loading image byte array
- Prev by Date: Re: key to speed - use byte array instead of writing to locked image bytes
- Next by Date: Using TextRenderer MeasureText to find word position - any ideas?
- Previous by thread: Re: Loading image byte array
- Next by thread: Re: Loading image byte array
- Index(es):
Relevant Pages
|