Newbie: Getting Image From Disk into Buffer

Ashley Lloyd ashleylloyd at
Fri Jan 9 12:01:12 CET 2004

Thanks very much for your reply.

I ended up getting this working by using:


I'd swear I tried this before with no success, but I can't have (or more 
than likely did it in the wrong way, somehow) - so sorry to everyone whose 
time I've wasted by asking such a stupid question!

Anyway, thanks very much once again for your reply.



>From: woodsplitter at (David Rushby)
>To: python-list at
>Subject: Re: Newbie: Getting Image From Disk into Buffer
>Date: 8 Jan 2004 13:27:49 -0800
>"Ashley Lloyd" <ashleylloyd at> wrote in message 
>news:<mailman.180.1073487526.12720.python-list at>...
> > I have been trying to get an image into an interbase database (see 
> > post), and came across a post made on a list some time ago (I ignored it
> > earlier as we use kinterbasDB not gvib, but I thought I'd try using it 
> > kinterbasDB anyway):
> > ...
> > it always seems to place
> > into the database a string of either the name of the image on disk
> > ('c:/image.bmp', say), or text such as the following:
> > <open file 'c:/image.bmp', mode 'rb' at 0x009F06A0>
>In the 'c:/image.bmp' case, you're inserting the file's name (string);
>in the "<open file 'c:/image.bmp', mode 'rb' at 0x009F06A0>" case,
>you're inserting an open file object, which is repr()ed into a string
>for storage.  Instead, you need to insert the *contents* of the file
>as a string, e.g., the return value of the file object's read()
> > ... but if someone could tell me how I get the image into blob_data
> > (which I assume is a buffer), I'd be very grateful.

It's fast, it's easy and it's free. Get MSN Messenger today!

More information about the Python-list mailing list