codecamp

Pillow PSDraw模块

这个 ​PSDraw ​模块为PostScript打印机提供简单的打印支持。您可以通过此模块打印文本、图形和图像。

classPIL.PSDraw.PSDraw(fp=None)

设置对给定文件的打印。如果省略​fp​,则假定为​sys.stdout.buffer​或​sys.stdout​。

begin_document(id=None)

设置文档的打印。(编写PostScript DSC标题。)

end_document()

结束打印。(编写PostScript DSC页脚。)

image(boximdpi=None)

在给定的框中居中绘制PIL图像。

line(xy0xy1)

在两点之间画一条线。坐标以PostScript点坐标给出(每英寸72点,(0,0)是页面的左下角)。

rectangle(box)

绘制矩形。

参数

box -- 一个整数的四元组,其顺序和函数当前未记录。

提示:元组被传递到此格式字符串中:

%d %d M %d %d 0 Vr
setfont(fontsize)

选择要使用的字体。

参数
  • font -- PostScript字体名

  • size --  以磅为单位的大小。

text(xytext)

在给定位置绘制文本。 在调用此方法之前,必须使用​setfont()​。


Pillow JpegProesets模块
Pillow PixelAccess类
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

Pillow 参考

Pillow ImageChops模块

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }