Question

I need to create a psd file to merge several images into a single layered one.
I saw that the gimp command line seems to be the only way to be able to do, but I would like to make this tool-independent.
Would there be another solution ?

For info I already looked into psd-tools, psdparse, pypsd that allows extracting layers from a psd to make a separate image with it but not the other way around.

o/

Était-ce utile?

La solution

I had looked into that issue myself some time ago for a client who was adamant on building an online-photo editor using Django.

For proper results you will likely have to rely on a native compiled library in some form or another. As most Python modules will wrap these libraries, you could stick to import os; os.system("gimp ...") or from subprocess import call; call(["gimp", "-i -b '(mygimpscript "test.psd" 2000 2000)'..."]) using the GIMP command line for instance.

From an Adobe blogger:

If you’re a developer, PSD’s complexity makes writing a file format reader/writer more difficult. Of course, PSD was never designed as or intended to be an interchange format.

The Readme from the current-work-in-progress psd-tools, also suggests that good psd-writers are still hard or even elusive to come by.


Despite that introduction,

For full compatibility with alpha blending, and metadata, the only option you got is using the proprietary COM32 based psd library from Adobe. Here is an example, and here another.

The advantage is a decent level of documentation. The disadvantage is that you will likely be platform bound.

Unfortunately the answer still appears to be:

No, there still is currently no way to write psd files in pure Python in a manner that would satisfy a productive level.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top