Python PSD图层? [英] Python PSD layers?

查看:622
本文介绍了Python PSD图层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个Python程序来加载PSD photoshop图像,该图像具有多个层并吐出png文件(每层一个). 你能用Python做到吗?我已经尝试过PIL,但是似乎没有任何访问层的方法.帮助. PS.编写自己的PSD加载器和png编写器显示速度太慢.

I need to write a Python program for loading a PSD photoshop image, which has multiple layers and spit out png files (one for each layer). Can you do that in Python? I've tried PIL, but there doesn't seem to be any method for accessing layers. Help. PS. Writing my own PSD loader and png writer has shown to be way too slow.

推荐答案

使用Gimp-Python吗? http://www.gimp.org/docs/python/index.html

Use Gimp-Python? http://www.gimp.org/docs/python/index.html

您不需要那样的Photoshop,它应该可以在运行Gimp和Python的任何平台上运行.这是一个很大的依赖,但是是一个免费的依赖.

You don't need Photoshop that way, and it should work on any platform that runs Gimp and Python. It's a large dependency, but a free one.

在PIL中执行此操作:

For doing it in PIL:

from PIL import Image, ImageSequence
im = Image.open("spam.psd")
layers = [frame.copy() for frame in ImageSequence.Iterator(im)]

确定,找到解决方案: https://github.com/jerem/psdparse

OK, found the solution: https://github.com/jerem/psdparse

这将允许您使用python从psd文件中提取图层,而没有任何非python的东西.

This will allow you to extract layers from a psd file with python without any non-python stuff.

这篇关于Python PSD图层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆