예제 #1
0
 def render(self, codestring):
     """
     >>> Renderer('foo').render('977147396801') # doctest: +ELLIPSIS
     <PIL.EpsImagePlugin.EpsImageFile instance at ...>
     """
     ps_code_buf = self.render_ps_code(codestring)
     return EpsImageFile(StringIO.StringIO(ps_code_buf))
예제 #2
0
파일: TestPil.py 프로젝트: orenlivne/ober
    def test_eps_to_png(self):
        '''Test that converting an EPS file to PNG using PIL works.'''
        src = """%!PS-Adobe 2.0
%%BoundingBox: 0 0 144 144
36 36 72 72 rectfill
/Courier findfont 12 scalefont setfont
36 120 moveto (text) show
showpage
"""
        im = EpsImageFile(StringIO(src))
        im.save(NamedTemporaryFile(suffix='.png'))