Re: Loading image byte array
- From: "Andreas" <dont.need@xxxxxxx>
- Date: Fri, 2 Feb 2007 10:05:21 +0100
Thanks Frank, I actually got it working myself before I saw your code. I
load the my image like Michael Phillips suggested. Sure I'm currently
limited to BMP fileformat but that can be changed. Wouldnt your method mean
I would your method mean I would, for a moment, have two bitmaps at the
same time? If I use large images then this will eat memory for sure.
The one advantage with your method is that I will be able to use various
fileformats "out of the box" and don't need to make my own file format
parsers (BMP was easy, but I fear PNG; JPG and GIF can be a bit tricker).
"Frank Hileman" <frankhil@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> skrev i
meddelandet news:%23RIeYmlRHHA.4632@xxxxxxxxxxxxxxxxxxxxxxx
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: Frank Hileman
- Re: Loading image byte array
- References:
- Re: Loading image byte array
- From: Frank Hileman
- Re: Loading image byte array
- Prev by Date: Re: Loading image byte array
- Next by Date: Re: Loading image byte array
- Previous by thread: Re: Loading image byte array
- Next by thread: Re: Loading image byte array
- Index(es):
Relevant Pages
|