如何在Python的网格结构中将几个图像结合到一个图像中?
我有几个图像(png格式),我想将它们组合到一个网格结构中(以这样的方式设置每个行中显示的图像数字)。另外,我想在图像之间添加少量的空白空间。
例如,假设有7张图像。我想设置每行中显示的图像数字3。组合图像的一般结构将为:
如果您知道一种很好的方法(最好是使用PIL/枕头
或matplotlib
库)。谢谢。
I have several images (PNG format) that I want to combine them into one image file in a grid structure (in such a way that I can set the No. of images shown in every row). Also, I want to add small empty space between images.
For example, assume that there are 7 images. And I want to set the No. of images shown in every row as 3. The general structure of the combined image will be:
Please let me know if you know a good way to do that (preferably using PIL/Pillow
or matplotlib
libraries). Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将
combine_images
传递到预期列的功能号码
,space
像素中的图像和>
> images> images
的列表:7张图像和3列的结果:

You can pass to the
combine_images
function number of expectedcolumns
,space
between images in pixels and the list ofimages
:Result for 7 images and 3 columns:
Result for 6 images and 2 columns: