Pointer to Image

Chris Jankowski cjankowski at hbr-inc.com
Tue Oct 19 16:37:36 CEST 2004

Hi all,
I am still new to using Python, so bare with me.  I am trying to call
a DLL from my program to use some of it's functions.  The only
parameter is supposed to be a pointer to an image.  I have tried
several variations on passing this parameter to the DLL and I am not
having much luck.  This is going to call other functions later for
OCR, but I want to get a simple one working first.

Here is my code:  (Very basic)

from ctypes import *
import Image

myOcr = windll.LoadLibrary('ocrdll.dll') # my DLL

mySize = myOcr.GetImgBitmapSize ## load the function

im = Image.open('C:\\chris.tif') ## load the Image
print id(im)  ## for testing print address of im

##myFile = c_char_p(id(im))  # I have tried several variations of this

x = mySize(myFile)  ##  Actual call to the DLL Function
                    ##  documentation only one parameter passed
pointer to Image
                    ##  Must be DIB Image(Device Independent Bitmap)
                    ##  (could this be the problem?)
Thanks for the help.

Chris J.

More information about the Python-list mailing list