Converting a PIL image object to a buffer

Simon Hibbs simon.hibbs at gmail.com
Wed Apr 1 15:35:30 EDT 2009


I'm trying to dump a snapshot of my application window to the
clipboard. I can use ImageGrab in PIL to get the screen data into a
PIL image object, which i have converted to a bitmap using ImageWin,
but when I try to pass this to the clipboard using -

win32clipboard.SetClipboardData(win32clipboard.CF_BITMAP, img)

It fails, telling be that "The object must support the buffer
interface".

How can I convert a PIL image into a buffer object? I can't find any
clues.

Help appreciated,

Simon Hibbs





More information about the Python-list mailing list