Save the image in the clipboatd - in Python/Tkinter?

Here is a script that should get let you get arbitrary clipboard data on windows.

Here is a script that should get let you get arbitrary clipboard data on windows. Import win32clipboard as clip # The standard windows clipboard formats formats = 'CF_OEMTEXT', 'CF_PALETTE', 'CF_TEXT', 'CF_ENHMETAFILE', 'CF_UNICODETEXT', 'CF_BITMAP', 'CF_METAFILEPICT', 'CF_DIB', 'CF_DIBV5' def getFromClipboard(format): '""Returns a given type of data from the clipboard. ' data = None clip.

OpenClipboard(0) if clip. IsClipboardFormatAvailable(format): data = clip. GetClipboardData(format) clip.CloseClipboard() return data good_formats = clip.

OpenClipboard(0) for format in formats: if clip. IsClipboardFormatAvailable(format): good_formats. Append(format) clip.CloseClipboard() # choose among the good formats here print good_formats # use the one you picked here data = getFromClipboard(good_formats0) Then data will be the raw image data and you can just save it to a file normally.

http://msdn.microsoft.com/en-us/library/ms649013%28v=VS.85%29.aspx http://docs.activestate.com/activepython/2.4/pywin32/win32clipboard__GetClipboardData_meth.html Provide some information, more is out there.

Ouch, I needed it for the complement Os'es: Linux & OSX! – alessandro Jul 26 at 8:14 I didn't see any way to get non-text clipboard data on posix systems. – agf Jul 26 at 12:31 any comment then on the idea here below?

– alessandro Jul 26 at 12:48 No -- it sounds like it'll work, but I don't know how to get the dimensions or anything like that. – agf Jul 26 at 12:50 may/may not help: effbot. Org/zone/pil-image-size.

Htm and mail.python. Org/pipermail/image-sig/2004-September/002955. Html – noob oddy Jul 267 at 4:21.

Well tkinter uses the PIL for most of its advanced image stuff, in which case this problem is quite simple: Just use Image. Frombuffer(mode, size, data) with the bytebuffer representing the image and then save it ala im. Save(filename)- if you want a special format you can also specify it.

If you want to do it without the PIL, I don't think tkinter offers that kind of functionality out of the box, its image support is extremely limited in itself.

This seems to be it! But I tried using it without luck with wx,wy = 3000,3000 buf = "a"*wx*wy im=Image. Frombuffer("L", (wx, wy), buf, "raw", "L", 0, 1) ... my problem is that I don't know how to know in advance the image size (nor the mode) of the image in the clipboard – alessandro Jul 26 at 8:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions