
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
根据图像进行排版。比如排成二行三列的布局。
.. code:: cmd
pip install photo-layout
::
Canvas(width=None, height=None, color="white", is_del_extra=False)
width
: 画布的宽度。height
: 画布的高度。color
: 画布的颜色。默认为白色\ white
\ 。is_del_extra
\ :是否删除画布中额外多出的部分。::
LayoutModel(canvas=Canvas, imagePath=None, row, column, space=10)
canvas
: Canvas
\ 对象。imagePath
\ :本地的图片路径。row
\ :行数。column
\ :列数。space
\ :间距。默认为\ 10
\ 。.. code:: python
from photo_layout.layout import Canvas, LayoutModel from photo_layout.image import LayoutImage
def main(): canvas = Canvas(color="pink") layout_model = LayoutModel(canvas=canvas, imagePath="test.jpg", row=3, column=3, space=10) layout_image = LayoutImage(layout=layout_model) image = layout_image.create() image.show()
if name == 'main': main()
效果图如下:
.. image:: https://raw.githubusercontent.com/zhenzi0322/photo-layout/master/examples/imgs/example1.jpg
当然你也可以调用\ image.save("imgs/example1.jpg")
\ 来保存到本地。
根据图片来填充整个画布.
.. code:: python
from photo_layout.layout import Canvas, LayoutModel from photo_layout.image import LayoutImage
def main(): canvas = Canvas(width=2000, height=800, color="pink") layout_model = LayoutModel(canvas=canvas, imagePath="test.jpg", space=10) layout_image = LayoutImage(layout=layout_model) image = layout_image.create() image.show()
if name == 'main': main()
效果图如下:
.. image:: https://raw.githubusercontent.com/zhenzi0322/photo-layout/master/examples/imgs/example2.jpg
根据图片来填充整个画布.
通过设置\ is_del_extra=True
\ 来删除画布额外多出的部分。
.. code:: python
from photo_layout.layout import Canvas, LayoutModel from photo_layout.image import LayoutImage
def main(): canvas = Canvas(width=2000, height=800, color="pink", is_del_extra=True) layout_model = LayoutModel(canvas=canvas, imagePath="test.jpg", space=10) layout_image = LayoutImage(layout=layout_model) image = layout_image.create() image.show()
if name == 'main': main()
效果图如下:
.. image:: https://raw.githubusercontent.com/zhenzi0322/photo-layout/master/examples/imgs/example3.jpg
FAQs
Photo Layout
We found that photo-layout demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.