Re: Problem with Bitmap loading
From: Davide (davide_pas_at_yahoo.it)
Date: 11/22/04
- Next message: Daniel Moth: "Re: Date and time"
- Previous message: Cassiano: "Date and time"
- In reply to: Peter Foot [MVP]: "Re: Problem with Bitmap loading"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Nov 2004 19:34:27 +0100
Hallo Peter
I have already used the BitmapEx of opencf but... I have the same problem :-(
I also go into the source code..
public BitmapEx(string filename)
{
if (File.Exists(filename))
{
hBitmap = GDIPlus.SHLoadImageFile(filename);<--------------------
//hBitmap = GDIPlus.LoadImageDec(filename);
if (hBitmap == IntPtr.Zero)
throw new FileNotFoundException("Invalid image file.");
GDIPlus.BITMAP bm = new GDIPlus.BITMAP();
GDIPlus.GetObject(hBitmap, Marshal.SizeOf(bm), ref bm);
width = bm.bmWidth; // Get width of bitmap
height = bm.bmHeight; // Get height of bitmap
widthBytes = bm.bmWidthBytes;
bitsPixel = bm.bmBitsPixel;
}
else
throw new FileNotFoundException("Image file doesn't exist.");
}
this is the opencf source code library, and i think that SHLLoadImageFile (taken directly from
gdi I saw) has the same problem...
The max bitmap loaded is 2560x2560 and when I try to load a 3072x3072 image it goes to outofmemory
"Invalid image file" exception (and I assure you that the files is correct...):-(
I'm thinking to use the standart CreateDIBSection and fill all the structure manually using the well
know libtiff,jpeglib (compiled from vce if i can compile it) and using the standard libray functions
for bmp files.
If you have another suggest please,send me.
Bye,
Davide
> Alex Yakhnin's BitmapEx class in the Smart Device Framework
> (www.opennetcf.org/sdf/) may contain all the functionality you need, you can
> create a BitmapEx from a filename and then use GraphicsEx to draw this - its
> all done using native GDI P/Invokes, so could probably save you some time -
> I assume this will respect the bit-depth of the source image, but admit I
> haven't tested the theory.
>
> Peter
>
- Next message: Daniel Moth: "Re: Date and time"
- Previous message: Cassiano: "Date and time"
- In reply to: Peter Foot [MVP]: "Re: Problem with Bitmap loading"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|