ecutuning
2018-05-23 22:49:08 +08:00
先安装必要的软件包。以 Ubuntu Linux 为例:
apt-get install python-dev libjpeg-dev python-pip
pip install pillow
然后用如下代码生成相应大小的图像文件。
#!/usr/bin/python
from PIL import Image
M1 = (1280, 960)
M2 = (1600, 1200)
M3 = (2048, 1536)
M4 = (2240, 1680)
M5 = (2560, 1920)
M6 = (3032, 2008)
M7 = (3072, 2304)
M8 = (3264, 2448)
COLOR = (255, 255, 255)
FORMAT = "PNG"
def create_image(filename, size, color):
img = Image.new('RGB', size, color)
img.save(filename, FORMAT)
create_image("1M.png", M1, COLOR)
create_image("2M.png", M2, COLOR)
create_image("3M.png", M3, COLOR)
create_image("4M.png", M4, COLOR)