Pointer to Image

Larry Bates lbates at syscononline.com
Tue Oct 19 10:57:05 EDT 2004


Chris Jankowski wrote:
> 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.

Can you supply any docs on the ocrdll.dll API (e.g example C
code or function/parameter documentation)?  I've interfaced
with ExperVision's OCR RTK Toolkit via calls to their .DLL
but it looks like you are using something different.

-Larry



More information about the Python-list mailing list