使用PIL翻译图像

时间:2016-06-02 07:10:48

标签: python

如何使用PIL和python将图像在四个方向之一中翻译5个像素。我已经看到我们可以使用["May 30, 2015 ", "Jun 6, 2015", "Jun 13, 2015", "Jun 20, 2015"] ,但我不知道该怎么做。

1 个答案:

答案 0 :(得分:6)

带有$filter

Image.transform(size, method, data)会返回图像的副本,其中已应用仿射变换矩阵(通过method=Image.AFFINE给出为6元组(a, b, c, d, e, f))。对于每个像素data,输出将计算为(x, y)。因此,如果您想应用翻译,只需查看矩阵的(ax+by+c, dx+ey+f)c值即可。

f