예제 #1
0
파일: raster_image.py 프로젝트: dvorberg/t4
def main(argv):
    img = Image.open(argv[1])
    
    document = dsc_document("Raster Image Demo")
    page = document.page()
    canvas = page.canvas(margin=mm(18), border=True)

    eps = raster_image(canvas, img, document_level=False,
                       border=True)
    page.append(eps)

    fp = open(sys.argv[1] + ".ps", "w")
    document.write_to(fp)
    fp.close()
예제 #2
0
파일: engine_one.py 프로젝트: dvorberg/t4
    def draw(self, canvas):
        image_box = box.raster_image(canvas, self.image,
                                     document_level=True,
                                     border=False, clip=False)
        iw, ih = self.image.size
        iw, ih = float(iw), float(ih)

        w, h = self.size(canvas)
        
        scale_factor = w / iw 
        
        canvas._("gsave",
                 0, canvas.h() - h, "translate",
                 scale_factor, scale_factor, "scale")
        canvas.append(image_box)
        canvas._("grestore")
        
        return h, True