Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
I thought I’d post the working SaveDIBAs method code for reference if anyone else runs across this issue.
public static bool SaveDIBAs( string fileName, IntPtr bminfo, IntPtr pixdat )
{
Guid clsid;
if( ! GetCodecClsid( fileName, out clsid ) )
{
MessageBox.Show( "Unknown picture format for extension " + Path.GetExtension( fileName ), "Image Codec", MessageBoxButtons.OK, MessageBoxIcon.Information );
return false;
}
IntPtr img = IntPtr.Zero;
int st = GdipCreateBitmapFromGdiDib( bminfo, pixdat, ref img );
if( (st != 0) || (img == IntPtr.Zero) )
return false;
// obtain managed bitmap image from gdiplus dll
MethodInfo mi = typeof(Bitmap).GetMethod("FromGDIplus", BindingFlags.Static | BindingFlags.NonPublic);
Bitmap bmp = (Bitmap)mi.Invoke(null, new object[] {img});
bmp.Save(fileName);
bmp.Dispose();
// causing the image to be saved in a default 24 bpp inflated format
//st = GdipSaveImageToFile( img, fileName, ref clsid, IntPtr.Zero );
GdipDisposeImage( img );
return st == 0;
}
Thanks for the reply, gabe. The scanner was apparently getting set properly. The problem I had was that the image was being saved via a method that uses the gdiplus.dll (from the NETMaster twain project) which, apparently, saves the image in a 24 bpp format regardless of the scanner settings. I modified the software to import the image into a .NET Image object and conducted the save from the .NET environment without altering the image. Problem solved.
Thanks again.
-aaron
- AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)