我正在尝试使用 pyvips 将多个图像连接在一起,但在此过程中图像的宽度增加了一倍以上,我似乎无法弄清楚为什么
这是我的代码的关键部分:
files = ['small_images\\'+filename for filename in os.listdir('small_images')]
files = natsorted(files)
images = [pyvips.Image.new_from_file(filename, access="sequential") for filename in files]
[print(f'width: {image.width}, height: {image.height}') for image in images]
raster = pyvips.Image.arrayjoin(images,across=len(images))
print(f'raster width: {raster.width}, raster height: {raster.height}')
raster.write_to_file(f'rasters.png')
5 个文件的预期输出应为:
width: 115, height: 1449
width: 44, height: 1449
width: 226, height: 1449
width: 74, height: 1449
width: 35, height: 1449
raster width: 494, raster height: 1449
但我的实际输出是:
width: 115, height: 1449
width: 44, height: 1449
width: 226, height: 1449
width: 74, height: 1449
width: 35, height: 1449
raster width: 1130, raster height: 1449
图片:https ://imgur.com/a/IDuRtIK
这是什么原因造成的?