简体   繁体   English

如何在python中创建大型缩放图像

[英]How to create a large zoomed image in python

Hi I currently have a graph of many data points with error bars and I was wondering how I can create an image from this that is very long horizontally. 嗨,我目前有一个带有误差线的许多数据点的图形,我想知道如何从水平方向很长的图像中创建一个图像。

This image is made up of 11, 256-point graphs appended on each-other. 该图像由彼此附加的11个256点图形组成。 I would like to create an image (.png) that has 256 points in it when it opens but can be scrolled to the right to see more of the same image. 我想创建一个在打开时具有256个点的图像(.png),但可以向右滚动以查看更多同一图像。

Thanks! 谢谢!

Here is a nice script that you can use that use from Jonas Wagner . 这是一个不错的脚本,您可以使用Jonas Wagner的用法。 Plus, it uses the cool python builtin function map() that I have never used before this. 另外,它使用了很酷的python内置函数map(),而我在此之前从未使用过。

from PIL import Image
import sys

if not len(sys.argv) > 3:
    raise SystemExit("Usage: %s src1 [src2] .. dest" % sys.argv[0])

images = map(Image.open, sys.argv[1:-1])
w = sum(i.size[0] for i in images)
mh = max(i.size[1] for i in images)

result = Image.new("RGBA", (w, mh))

x = 0
for i in images:
    result.paste(i, (x, 0))
    x += i.size[0]

result.save(sys.argv[-1])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM