How to plot several image tiles in new emty image object based on image tile name in python?

[亡魂溺海] 提交于 2020-05-17 06:00:33

问题


I need to request several image tiles from a server and plot them in the new image object and save it as a jpg file. Image tile name starts at its position in new image object: e.g. position:x0,y0 --> Tile name: 00 I know how to do https request, and how to create new empty image objects I can use PIL:

import requests
from PIL import Image

url = f‘https://myserver.com/GetTile/{tileKey}’
imageTile = requests.get(url)

image_sheet = Image.new("RGB", (8192, 4096))

Where I have stuck is how to horizontally loop over new image object to form the tile name, and later requesting from the server the tile and place it in the new image_sheet. And repeat the process until all tiles are on the place. When it is done save the result as a file. Please help to the python noob.

来源:https://stackoverflow.com/questions/61630596/how-to-plot-several-image-tiles-in-new-emty-image-object-based-on-image-tile-nam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!