I have an image (jpg, png, etc.) in the windows clipboard. I\'d like to save it to a file. win32clipboard would seem to be the answer, but every example I can find deals wi
The function win32clipboard.GetClipboardData()
has a parameter. The default parameter specifies that you want the contents of the clipboard as text. You need to pass in the value that specifies the data format you want the clipboard to give you.
The standard clipboard data formats are documented here.
ALSO:
See here for documentation on EnumClipboardFormats()
-- basically, you need code like this (untested) to get the formats that are available currently on the clipboard:
formats = []
lastFormat = 0
while 1:
nextFormat = win32clipboard.EnumClipboardFormats(lastFormat)
if 0 == nextFormat:
# all done -- get out of the loop
break
else:
formats.append(nextFormat)
lastFormat = nextFormat
# when you get here, formats contains a list of format codes that
# you can retrieve from the clipboard right now.