def _saveAsPICT(im,fn,fmt,transparent=None): im = _convert2pilp(im) cols, rows = im.size #s = _renderPM.pil2pict(cols,rows,im.tostring(),im.im.getpalette(),transparent is not None and Color2Hex(transparent) or -1) s = _renderPM.pil2pict(cols,rows,im.tostring(),im.im.getpalette()) if not hasattr(fn,'write'): open(os.path.splitext(fn)[0]+'.'+fmt.lower(),'wb').write(s) if os.name=='mac': from reportlab.lib.utils import markfilename markfilename(fn,ext='PICT') else: fn.write(s)