LEADTOOLS Support
Imaging
Imaging SDK Questions
CreateLeadDC() on RasterImage returning null pointer on certain images
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, December 10, 2008 2:12:39 PM(UTC)
Groups: Registered
Posts: 4
In a directory of 317 images I have 3 gifs that cause an error because CreateLeadDC() on those images returns a null pointer. I'll attach one of those images.
This is the code I'm using:
IntPtr hDC = IntPtr.Zero;
try
{
hDC = canvas.CreateLeadDC();
using (Graphics g = Graphics.FromHdc(hDC))
{
this.TopZone.CalculateSize(g, renderingWidth);
this.BottomZone.CalculateSize(g, renderingWidth);
}
}
finally
{
if (hDC != IntPtr.Zero)
RasterImage.DeleteLeadDC(hDC);
}
}
Your help is greatly appreciated.
lazycoder attached the following image(s):
#2
Posted
:
Thursday, December 11, 2008 2:08:54 PM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
The attached image has a pixel depth (color resolution) of 7 bits per pixel. This value is correct for GIF images and for LEAD bitmaps in memory, but it is not compatible with GDI. You can try to load it at 8 or 24 BPP, or convert it using the ColorResolutionCommand class.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
Imaging
Imaging SDK Questions
CreateLeadDC() on RasterImage returning null pointer on certain images
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.