python - 如何使用 Python 实现类似深度效果的 Photoshop“斜面/浮雕”?
问题描述
我想将图像放在背景图像之上,并使用 Python 在图像上应用“斜角/浮雕”效果。我尝试使用 PIL 库,但也欢迎对其他库提出建议。
这应该是这样的:
我有以下代码:
from PIL import Image
from PIL import ImageFilter
img = Image.open('./image.jpeg', 'r')
# this doesn't do what I want...
img = img .filter(ImageFilter.EMBOSS)
background = Image.open('./bg.png', 'r')
background.paste(img)
我使用 Affinity Photo 作为示例图像。在Photoshop中应该几乎相同。以下是我使用的设置:
解决方案
我仍然不知道如何在 python 中执行此操作,但我找到了一种方法,结合使用批处理作业和 Affinity Photo 中的宏功能。
- 录制将所需效果应用于图像的宏
- 将所有需要效果的图像放在一个文件夹中
- 启动批处理作业并将宏应用于所有图像
此处描述了如何开始批处理作业:http: //www.millermattson.com/blog/batch-processing-with-affinity-photo/
推荐阅读
- selenium - 在 zalenium 中捕获音频
- php - 如何覆盖设置了参数类型提示的 php 函数?
- windows-server-2012-r2 - 当包含文件夹有多个文件时,IIS 无法提供 PDF 文件
- python-3.x - 是否有任何方法可以检测 WebSocketClientProtocol 的 sendMessage() 是否实际将消息传递到服务器?
- r - 从带有填充的连续日期数据创建带有年份条的箱线图
- javascript - 递归遍历具有多条路径的数组的最有效方法是什么
- php - 如何创建和运行自定义数据库?
- c# - TFS / Azure-DevOps - REST API:构建定义列表 - 如何包含所有属性
- c++ - C++ Pimpl Idiom 使用预先存在的类
- r - 是否有一个 R 函数来获取无向(非有向)网络中的唯一边缘?