SOS Win - How to save metafile as Bitmap ?

fowlertrainer at citromail.hu fowlertrainer at citromail.hu
Mon Feb 7 03:58:34 EST 2005


Hi !

My problem is that: I have a program that copy pictures from Notes NSF file.
The format is METAFILE or METAFILEPICT.

I can save these pictures with this code:

import win32api
import win32con
import win32gui
...
mode=0
if mode==0:
   import win32clipboard, win32con
   win32clipboard.OpenClipboard()
   try:
       if 
win32clipboard.IsClipboardFormatAvailable(win32con.CF_ENHMETAFILE):
          print "METAFILE"
          hdl=win32clipboard.GetClipboardData(win32con.CF_ENHMETAFILE)
          f=open('c:\\test.emf','wb')
          f.write(hdl)
          f.close()
   finally:
       win32clipboard.CloseClipboard()
...

But I need to convert them to BMP files.
I have wxPython, and PIL, and win32api ext.

wxPython have wxMetaFile class, but I cannot found it's import path. 
import ????
PIL have clipboard tool, but it is make wrong palette for these copies.

So what is the better, "simplier" (have the english a word like this ?) 
solution to my problem ?

Thanx for the quick help:
 ft

PS:
 Do not use outer program for convert it. I have it same program, but I 
want to do it in python !!!



More information about the Python-list mailing list