PhotoshopAPI a Read and Write parser of PSD files with Python and C++

  Kiến thức lập trình

Hello this question is related to finding help from smart people that want to help us out collaborating on Emil Dohne’s open project of a modern and performant C++20 read/write parser of Photoshop Files (*.psd and *.psb) with fully fledged Python bindings hosted on PyPi.

I just wanted to help him out trying to make this work known, so that more people can utilize this incredibily useful repo and in order to find someone incredibly talented and kind people that wanted to help him out collaborating in the development! At the moment Emil is occupied by another project that he will end by the end of July and he will then be back 100% on this project.

The hierarchy of new features needed/highly requested are the following:

  1. Support for Smart Object Layers – replacing images inside of the smart object
  2. Support for Adjustment Layers
  3. Support for Vector Masks
  4. Support for Text Layers
  5. CMYK, Indexed, Duotone and Greyscale Color Modes

Thank you to whoever even takes the time to read this, let alone whoever shares this project and even more to incredibly smart people that will help Emil out.

Here’s some more info about this project: https://github.com/EmilDohne/PhotoshopAPI

About

PhotoshopAPI is a C++20 Library with Python bindings for reading and writing of Photoshop Files (*.psd and *.psb) based on previous works from psd_sdk, pytoshop and psd-tools. As well as the official Photoshop File Format Specification, where applicable. The library is continuously tested for correctness in its core functionality. If you do find a bug please submit an issue to the github page.

The motivation to create another library despite all the other works present is that there isn’t a library which has layer editing as a first class citizen while also supporting all bit-depths known to Photoshop (8-bits, 16-bits, 32-bits). This Library aims to create an abstraction between the raw binary file format and the structure that the user interfaces against to provide a more intuitive approach to the editing of Photoshop Files.

Why should you care?

Photoshop itself is unfortunately often slow to read/write files and the built-in tools for automatically/programmatically modifying files suffer this same issue. On top of this, due to the extensive history of the Photoshop File Format, Photoshop files written out by Photoshop itself are often unnecessarily bloated to add backwards compatibility or cross-software compatibility.

The PhotoshopAPI tries to address these issue by allowing the user to read/write/modify Photoshop Files without ever having to enter Photoshop itself which additionally means, no license is required. It is roughly 5-10x faster in reads and 20x faster in writes than photoshop while producing files that are consistently 20-50% lower in size (see the benchmarks section on readthedocs for details). The cost of parsing is paid up front either on read or on write so modifying the layer structure itself is almost instantaneous (except for adding new layers).

Features

Supported:

  • Read and write of *.psd and *.psb files
  • Creating and modifying simple and complex nested layer structures
  • Pixel Masks
  • Modifying layer attributes (name, blend mode etc.)
  • Setting the Display ICC Profile
  • Setting the DPI of the document
  • 8-, 16- and 32-bit files
  • RGB Color Mode
  • All compression modes known to Photoshop

Planned:

  • Support for Smart Object Layers
  • Support for Adjustment Layers
  • Support for Vector Masks
  • Support for Text Layers
  • CMYK, Indexed, Duotone and Greyscale Color Modes

Not Supported:

  • Files written by the PhotoshopAPI do not contain a valid merged image in order to save size meaning they will not behave properly when opened in third party apps requiring these (such as Lightroom)
  • Lab and Multichannel Color Modes

Python

The PhotoshopAPI comes with fully fledged Python bindings which can be simply installed using

py -m pip install PhotoshopAPI

alternatively the wheels can be downloaded from the Releases page. For examples on how to use the python bindings please refer to the Python Bindings section on Readthedocs or check out the PhotoshopExamples/ directory on the github page which includes examples for Python as well as C++.

For an even quicker way of getting started check out the Quickstart section!

Documentation

The full documentation with benchmarks, build instructions and code reference is hosted on the PhotoshopAPI readthedocs page.

Requirements

This goes over requirements for usage, for development requirements please visit the docs.

A CPU with AVX2 support (this is most CPUs after 2014) will greatly increase performance, if we detect this to not be there we disable this optimization

A 64-bit system

C++ Library: Linux, Windows or MacOS

Python Library1: Linux, Windows, MacOS

The python bindings support python >=3.7 (except for ARM-based MacOS machines which raise this to >=3.10)

Performance

The PhotoshopAPI is built with performance as one of its foremost concerns. Using it should enable you to optimize your pipeline rather than slow it down. It runs fully multithreaded with SIMD instructions to leverage all the computing power your computer can afford.

As the feature set increases this will keep being one of the key requirements. For detailed benchmarks running on a variety of different configurations please visit the docs

On github you can find some of the benchmarks comparing the PhotoshopAPI (‘PSAPI’) against Photoshop in read/write performance

New contributor

Polli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT