How to save bitmap from MS Windows clipboard to xxx.png?

Petr Prikryl Answer.via.news.please.prikryl at skil.nospam.cz
Fri Apr 19 08:08:40 EDT 2002


Hi,

I am quite new to Python to now what was done already
and what was not.

What I need is to save the window snapshot (in MS
Windows) into PNG file.  It just came to my mind that
some Python utility may already exist for that task
or that some PNG support is implemented.

How I am doing it now
=====================

Say, some error message box is displayed by a MS
Windows application.  I do press `Alt-Print Screen`
to copy the bitmap of the window into the clipboard.

Then I run the graphic editor (CorelXara in my case),
paste the content of the clipboard into the new
document, and export the result into PNG file.

I am converting the bitmap to the form with 4 bits
per pixel, optimized palette, no dithering, no
interlace.  This way the snapshots files are
reasonably small and very well displayed on HTML
pages (yet another bug tracing + doc system ;-).


How would I like to do it
=========================

It would be nice if I could simply capture the bitmap
into clipboard and then just run some Python script
(command line) with filename as the only argument.


If there is nothing like this ready to run, could you
point me to some resources that would help me to
write such utility?  Any other comments?


Thanks for your time and the experience,
  Petr

--
Petr Prikryl (prikrylp at skil dot cz)






More information about the Python-list mailing list