[Pythoncard-users] saveClipboardBitmap sample
by Kevin Altis other posts by this author
Apr 19 2002 11:57PM messages near this date
[Pythoncard-users] small doodle bug
|
[Pythoncard-users] app close event?
I've been creating screenshots in Windows by using Alt-PrintScreen to
capture a window image, opening Microsoft Paint, pasting, and saving the
file in BMP format. Then I was using bmp2png described by Neil here:
http://aspn.activestate.com/ASPN/Mail/Message/1012716
to convert the BMP image to a nice PNG format image that I can use in
documentation. Not surprisingly this was a bit tedious, especially since it
involved many steps and use of the command-line in addition to MS Paint.
Somebody posted on c.l.py today that was essentially doing the same tedious
steps as me and I realized I already had most of the code in the doodle
sample to simplify the process.
After a bit of copying and pasting and some small modifications, I present a
very simple, single purpose sample for saving the bitmap contents of the
clipboard in a file format of your choice, verbosely named as the
saveClipboardBitmap sample.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pythoncard/PythonCardPrototyp
e/samples/saveClipboardBitmap/
You can just download this script directly if you aren't using cvs. I've
included the readme.txt below.
ka
---
readme.txt
This is a very simple, single purpose, sample. I wrote it to avoid having to
paste screenshots into MS Paint, save them as BMP files and then convert to
PNG format using a command-line tool.
If the clipboard contains a bitmap you can save that bitmap to disk in a
variety of formats, by pressing Ctrl+S or selecting Save As... from the file
menu. You can provide the extension (.jpg, .png, .bmp) to save the file in
and the script will choose the format based on the extension. You can leave
saveClipboardBitmap app open and then capture a different bitmap in the
clipboard, switch back to saveClipboardBitmap and do another save. As a
convenience, if the clipboard contains a valid bitmap when the app is
started you will be prompted to do a Save As immediately without having to
type Ctrl+S or select Save As...
Due to licensing issues, wxWindows does not contain code to save GIF images.
PNG is generally preferred for screenshots, but if there is demand I could
add Python Imaging Library (PIL) support, which I think can save in GIF
format.
I'll probably add a clipboard preview to the script once I get a chance to
play with it some more.
saveClipboardBitmap is another sample that has no resource file. See the
noresource sample for more of an explanation.
_______________________________________________
Pythoncard-users mailing list
Pythoncard-users@[...].net
https://lists.sourceforge.net/lists/listinfo/pythoncard-users
|