banner



How To Rasterize A Photoshop Layer In Python

Projection description

psd-tools is a Python package for working with Adobe Photoshop PSD files every bit described in specification.

PyPI Version Build Document Status

Features

Supported:

  • Read and write of the low-level PSD/PSB file construction
  • Raw layer prototype export in NumPy and PIL format

Limited support:

  • Composition of basic pixel-based layers
  • Composition of fill layer effects
  • Vector masks
  • Editing of some layer attributes such as layer name
  • Blending modes except for deliquesce
  • Cartoon of bezier curves

Not supported:

  • Editing of layer structure, such as calculation or removing a layer
  • Composition of adjustment layers
  • Composition of many layer furnishings
  • Font rendering

Installation

Use pip to install the parcel:

pip install psd-tools            

Getting started

              from              psd_tools              import              PSDImage              psd              =              PSDImage              .              open              (              'example.psd'              )              psd              .              blended              ()              .              salve              (              'example.png'              )              for              layer              in              psd              :              impress              (              layer              )              layer_image              =              layer              .              composite              ()              layer_image              .              relieve              (              '              %s              .png'              %              layer              .              name              )            

Cheque out the documentation for features and details.

Contributing

See contributing folio.

Note

PSD specification is far from consummate. If you cannot detect a desired information in the documentation, you should inspect the depression-level information structure.

one.ix.19 (2021-04-fifteen)

  • [blended] Gear up rasterized shape composite (#301 #302)

i.9.18 (2021-08-20)

  • [api] Set missing consequence attributes (#284)
  • [package] Support boosted platforms (i686, aarch64, universal2, win32)
  • [package] Driblet py36 support

i.ix.17 (2021-01-15)

  • [api] Fix wrong fill layer parse (fix #254)

1.9.sixteen (2020-09-24)

  • [bundle] Drop py27 and py35 support
  • [psd] Workaround Enum bug (fix #241)
  • [composite] Fix transparency issue (ready #242)
  • [composite] Fix mask disable flag (fix #243)
  • [api] Add together workaround for creating PSB (fix #246)
  • [api] Ready incorrect aligning parse (fix #247)

1.9.15 (2020-07-17)

  • [composite] Fix ignored prune layers for groups.
  • [composite] Prepare out-of-viewport stroke effect.

i.9.14 (2020-07-x)

  • [api] Bugfix for PSDImage composite layer_filter option.
  • [api] Bugfix for transparency and blastoff distinction.
  • [psd] Rename COMPOSITOR_INFO.
  • [composite] Fix stroke consequence target shape.

1.9.13 (2020-05-25)

  • [api] Bugfix for PSDImage init internal.

1.nine.12 (2020-05-20)

  • [psd] Bugfix for CurvesExtraMarker read.

i.9.eleven (2020-05-01)

  • [composite] Fix layer check.

1.nine.10 (2020-04-21)

  • [psd] Prepare engine data parser.

one.9.nine (2020-03-30)

  • [composite] Prepare stroke event argument.

1.nine.viii (2020-03-18)

  • [blended] Fix incorrect fill opacity handling in compositing.
  • [blended] Fix wrong alpha for patterns.

1.9.7 (2020-03-17)

  • [composite] Fix path operation for merged components.
  • [composite] Fix vector mask compositing status.

1.9.6 (2020-03-16)

  • [blended] Prepare incorrect blastoff aqueduct handling in blended.

1.ix.5 (2020-03-11)

  • [api] Add ignore_preview option to PSDImage.composite.
  • [composite] Improve stroke issue composition for vector masks.
  • [composite] Avoid crash when in that location is an erroneous subpath.
  • [composite] Workaround possible divide-by-zero warn in stroke composition.
  • [composite] Fix incorrect design transparency handling.
  • [composite] Fix ignored effects in direct group limerick.
  • [composite] Prepare incorrect opacity handling for clip layers.

i.9.4 (2020-03-11)

  • [compression] Security gear up, affected versions are one.8.37 - one.nine.3.

1.ix.three (2020-03-10)

  • [composite] Prepare memory corruption crash for pattern data in PSB files.
  • [psd] Add image data pretty press.

i.9.2 (2020-03-03)

  • [psd] Add missing resource ID.
  • [psd] Fix pretty press regression.
  • [psd] Set up large tag key for linked layers.
  • [psd] Support frgb tag.
  • [psd] Support sgrp metadata cardinal.
  • [psd] Support patt tag.
  • [psd] Workaround unknown engine information.

1.9.1 (2020-02-28)

  • [psd] Minor bugfix.

1.9.0 (2020-02-26)

  • [composite] Implement NumPy-based compositing functionality.
  • [composite] Support blending modes other than deliquesce.
  • [composite] Back up blending in RGB, CMYK, Grayscale.
  • [api] Introduce NumPy array export method.
  • [api] Drop deprecated methods from v1.7.x such as as_PIL.
  • [api] Deprecate compose method.
  • [compression] Rename packbits to rle.
  • [compression] Better RLE decode efficiency.
  • [tests] Additional compositing tests.

one.8.38 (2020-02-12)

  • [composer] set crash when gradient fill is in stroke.

i.8.37 (2020-02-07)

  • [compression] Remove packbits dependency and introduce cython implementation.
  • [deploy] Move CI provider from Travis-CI to Github Actions.
  • [deploy] Start distributing binary wheels.

1.8.36 (2019-12-26)

  • [psd] add together safeguard for malformed global layer mask info parser.

1.8.35 (2019-12-26)

  • [api] remove indistinguishable has_mask() definition.
  • [composer] fix empty effects cheque.

one.8.34 (2019-11-28)

  • [api] fix etch() arguments.
  • [psd] set up attrs version dependency.

i.8.33 (2019-11-28)

  • [api] add together include_invisible option to Group.extract_bbox.
  • [psd] set up deprecated attrs api.

1.eight.32 (2019-xi-28)

  • [psd] ready sixteen/32 chip file parsing bug introduced in ane.viii.17.

1.viii.31 (2019-11-27)

  • [psd] bugfix reading psb.
  • [psd] bugfix reading slices resource.
  • [security] update dependency to pillow >= 6.2.0.

i.8.30 (2019-09-24)

  • [psd] workaround for reading less-than-iv-byte int in malformed psd files.

i.viii.29 (2019-09-10)

  • [composer] fix vector mask bbox in composition.

1.8.28 (2019-09-09)

  • [api] fix Effects.__repr__() when data is empty.

1.8.27 (2019-08-29)

  • [api] accept encoding param in PSDImage.open up and PSDImage.save.
  • [deploy] bugfix travis deployment condition.

1.eight.26 (2019-08-28)

  • [composer] support grouping mask.

1.8.25 (2019-08-07)

  • [api] change return type of PSDImage.color_mode to enum.
  • [api] support reading of bitmap color fashion.
  • [api] back up channel option in topil() method.

1.viii.24 (2019-07-25)

  • [composer] experimental support of commutative blending modes.

one.viii.23 (2019-06-24)

  • [composer] fix clipping on alpha-less image;
  • [composer] fix stroke consequence for apartment airplane;
  • [composer] workaround for insufficient knots;
  • [composer] prepare for custom colour space.

1.viii.22 (2019-06-19)

  • fix laissez passer-through composing bug;
  • set alpha blending in result;
  • fix vector mask composition;
  • experimental support for shape stroke;
  • experimental back up for stroke issue.

1.8.21 (2019-06-18)

  • change event property return type from str to enum;
  • amend gradient quality;
  • back up fill opacity and layer opacity;
  • add tmln key in metadata setting.

1.viii.xx (2019-06-13)

  • back up slope styles.

1.8.19 (2019-06-xi)

  • ready broken psd_tools.composer.vector module in 1.8.17;
  • experimental support for colour noise slope;
  • bugfix for clip masks;
  • bugfix for CMYK composing.

1.viii.17 (2019-06-05)

  • move psd_tools.api.composer module to psd_tools.composer parcel;
  • back up 19 blending modes in composer;
  • back up fill up opacity;
  • fix prototype size when composing with masks;
  • rename TaggedBlockID to Tag;
  • rename ImageResourceID to Resource;
  • add together bytes mixin to Enum constants;
  • replace Enum keys with raw values in psd_tools.psd.base of operations.Dict classes.

ane.viii.16 (2019-05-24)

  • prepare broken group etch in 1.8.15;
  • prepare missing pattern / slope composition in vector stroke content.

ane.eight.15 (2019-05-23)

  • coding style fix;
  • fix compose() bbox option.

i.viii.xiv (2019-04-12)

  • add dependency to aggdraw;
  • back up bezier curves in vector masks;
  • support path operations;
  • fix compose(force=Truthful) behavior;
  • fix default background colour in composer;
  • better design overlay parameters back up;
  • fix gradient map generation for a single stop.

ane.eight.thirteen (2019-04-05)

  • prepare engine_data unknown tag format;
  • fix compose for extra alpha channels;
  • workaround for pillow half-dozen.0.0 bug.

one.8.12 (2019-03-25)

  • add apply_icc option in pil io.

1.eight.11 (2019-03-14)

  • introduce terminology module;
  • reduce retentiveness employ in read;
  • add main testing.

1.viii.x (2019-02-27)

  • gear up PSB extn key size bug.

1.8.ix (2019-02-21)

  • documentation updates;
  • innovate Artboard form.

1.8.viii (2019-02-20)

  • revert package proper noun to psd_tools;
  • fix merging to the primary repo.

ane.eight.7 (2019-02-15)

  • minor bugfix.

1.8.half-dozen (2019-02-xiv)

  • change _psd arrow in PSDImage;
  • add version property;
  • back up fill up effects in composer.

ane.8.5 (2019-02-05)

  • change tagged cake/image resources singleton accessor in user API;
  • add documentation on iterator order;
  • set export setting 1 big central config;
  • fix reckoner info large cardinal config.

i.8.3 (2019-02-01)

  • add channel size checking in topil;
  • add mlst metadata decoding;
  • prepare key collision upshot in descriptor;
  • performance improvement for packbit encoding/decoding;
  • drib cython dependency in travis config;
  • implement thumbnail, is_group, and parent methods in PSDImage.

1.8.0 (2019-01-24)

  • major API changes;
  • package name changed to psd_tools2;
  • completely rewritten decoding subpackage psd_tools2.psd;
  • improved composer functionality;
  • file write back up;
  • drop cython pinch module and makes the package pure-python;
  • drib pymaging back up.

1.7.thirty (2019-01-15)

  • composer alpha blending fix;
  • documentation fix.

1.7.28 (2019-01-09)

  • back up cinf tagged cake.

ane.7.27 (2018-12-06)

  • add together missing extra prototype resource block signatures.

1.7.26 (2018-12-03)

  • movement psd_tools tests under tests/psd_tools.

1.7.25 (2018-11-27)

  • fix blastoff aqueduct visibility of composed image.

ane.7.24 (2018-eleven-21)

  • set unit rectangle cartoon size.

ane.7.23 (2018-xi-20)

  • fix ignored visibility in bbox calculation.

i.7.22 (2018-10-12)

  • driblet py34 support;
  • fix tobytes deprecation alarm.

i.seven.21 (2018-x-ten)

  • fix gradient descriptor problems.

i.7.20 (2018-10-09)

  • set coloroverlay problems;
  • fix gradient angle bug;
  • ready curves decoder bug.

one.7.xix (2018-10-02)

  • set descriptor decoder.

1.7.18 (2018-09-26)

  • add shape rendering in compose();
  • add grayscale support.

one.vii.17 (2018-09-21)

  • set up has_pixel() condition.

i.seven.xvi (2018-08-29)

  • prepare fill opacity in compose();
  • workaround for broken PrintFlags.

1.7.15 (2018-08-28)

  • prepare color overlay issue in etch().

1.7.14 (2018-08-24)

  • gear up verbose arg for python iii.7 compatibility.

ane.7.13 (2018-08-ten)

  • fix has_pixel() for partial channels;
  • back up color overlay in compose().

1.vii.12 (2018-06-25)

  • ready mask rendering in etch (Thanks @andrey-hider and @nkato).

1.7.11 (2018-06-eleven)

  • unicode bugfixes.

ane.7.10 (2018-06-06)

  • fix descriptor decoding errors;
  • minor bugfixes.

1.vii.9 (2018-06-05)

  • fix UnicodeError in exif;
  • workaround for irregular descriptor name;
  • add together undocumented extn tagged cake decoding;
  • motion duplicated icc module to subpackage;
  • back up PIL rendering with extra alpha channels.

1.seven.viii (2018-05-29)

  • update documentation;
  • fix PEP8 compliance;
  • rename merge_layers to compose.

i.7.vii (2018-05-02)

  • fix white background event in as_PIL().

one.7.6 (2018-04-27)

  • add quality testing;
  • fix disabled mask.

i.seven.5 (2018-04-25)

  • fix has_mask() condition;
  • add mask composition in merge_layers();
  • fix mask display.

1.7.4 (2018-03-06)

  • fix infinity loop in print_tree().

1.7.3 (2018-02-27)

  • add vector origination API;
  • prepare shape and vector mask identification;
  • alter enum name conversion;
  • update docs.

1.vii.2 (2018-02-14)

  • add adjustments API;
  • add mask API;
  • bugfix for tagged_blocks decoders.

ane.7.1 (2018-02-08)

  • add mask user API;
  • add layer coordinate user API;
  • add vector mask and vector stroke API;
  • cleanup user API;
  • add together automatic descriptor conversion.

i.seven.0 (2018-01-25)

  • cleanup user API system;
  • remove json encoder api;
  • brand cli a parcel main.

i.vi.7 (2018-01-17)

  • workaround for anaconda 2.7 pillow;
  • bbox existence checkf.

one.six.vi (2018-01-10)

  • experimental clipping support in merge_layer();
  • revert as_PIL() in AdjustmentLayer.

one.half-dozen.5 (2017-12-22)

  • Small fix for erroneous unicode path proper noun

1.6.4 (2017-12-20)

  • Add all_layers() method;
  • Add _image_resource_blocks belongings;
  • Add thumbnail() method.

1.6.3 (2017-09-27)

  • documentation updates;
  • github repository renamed to psd-tools2;
  • AdjustmentLayer fix.

1.6.ii (2017-09-thirteen)

  • layer class construction reorganization;
  • add Furnishings API;
  • add TypeLayer API methods.

ane.half dozen (2017-09-08)

  • PSDImage user API update;
  • user API adds distinct layer types;
  • Sphinx documentation.

1.v (2017-07-13)

  • implemented many decodings of image resources and tagged blocks;
  • implemented EngineData text data;
  • user API for getting mask and patterns;
  • user API to summate bbox for shape layers;

i.4 (2017-01-02)

  • Fixed reading of layer mask data (thanks Evgeny Kopylov);
  • Python two.half dozen support is dropped;
  • Python 3.6 support is added (thanks Leendert Brouwer);
  • extension is rebuilt with Cython 0.25.2.

1.three (2016-01-25)

  • fixed references decoding (thanks Josh Drake);
  • fixed PIL support for CMYK files (thanks Michael Wu);
  • optional C extension is rebuilt with Cython 0.23.4;
  • Python iii.2 support is dropped; the package nonetheless works in Python 3.2, but the compatibility is no longer checked by tests, and and then information technology can break in future.
  • declare Python 3.5 as supported.

1.ii (2015-01-27)

  • implemented extraction of embedded files (embedded smart objects) - thank you Volker Braun;
  • optional C extension is rebuilt with Cython 0.21.two.
  • hg mirror on bitbucket is dropped, sorry!

1.1 (2014-11-17)

  • improved METADATA_SETTING decoding (thank you Evgeny Kopylov);
  • layer comps decoding (thanks Evgeny Kopylov);
  • improved smart objects decoding (thanks Joey Gentry);
  • user API for getting layer transforms and placed layer size (thanks Joey Gentry);
  • IPython import is deferred to speedup psd-tools.py command-line utility;
  • _RootGroup.__repr__ is fixed;
  • warning message edifice is more robust;
  • optional C extension is rebuilt with Cython 0.21.1.

1.0 (2014-07-24)

  • Stock-still reading of images with layer masks (thanks Evgeny Kopylov);
  • improved mask information decoding (thanks Evgeny Kopylov);
  • stock-still synchronization in case of 8B64 signatures (thanks Evgeny Kopylov);
  • fixed reading of layers with zero length (thanks Evgeny Kopylov);
  • fixed Descriptor parsing (thanks Evgeny Kopylov);
  • some of the descriptor structures and tagged block constants are renamed (cheers Evgeny Kopylov);
  • PATH_SELECTION_STATE decoding (cheers Evgeny Kopylov);
  • the library is switched to setuptools; docopt is now installed automatically.

0.ten (2014-06-xv)

  • Layer furnishings parsing (thank you Evgeny Kopylov);
  • trailing naught bytes are stripped from descriptor strings (cheers Evgeny Kopylov);
  • "Reference" and "List" descriptor parsing is fixed (thanks Evgeny Kopylov);
  • scalar descriptor values (doubles, floats, booleans) are now returned as scalars, not as lists of size 1 (thanks Evgeny Kopylov);
  • fixed reading of EngineData past declared length (cheers Carlton P. Taylor);
  • "background colour" Prototype Resource parsing (cheers Evgeny Kopylov);
  • psd_tools.decoder.actions.Enum.enum field is renamed to psd_tools.decoder.actions.Enum.value (thank you Evgeny Kopylov);
  • code simplification - constants are now bytestrings as they should be (thanks Evgeny Kopylov);
  • Python iii.iv is supported.

0.9.1 (2014-03-26)

  • Improved merging of transparent layers (thank you Vladimir Timofeev);
  • stock-still layer merging and bounding box calculations for empty layers (thanks Vladimir Timofeev);
  • C extension is rebuilt with Cython 0.20.1.

0.9 (2013-12-03)

  • psd-tools.py command-line interface is inverse, 'debug' command is added;
  • pretty-printing of internal structures;
  • pymaging support is fixed;
  • allow 'MeSa' to be a signature for prototype resource blocks (thank you Alexey Buzanov);
  • psd_tools.debug.debug_view utility function is fixed;
  • Photoshop CC constants are added;
  • Photoshop CC vector origination data is decoded;
  • binary data is preserved if descriptor parsing fails;
  • more verbose logging for PSD reader;
  • channel data reader became more robust - at present it doesn't read by declared channel length;
  • psd-tools.py –version command is stock-still;
  • lsdk tagged blocks parsing: this fixes some problems with layer grouping (thanks Ivan Maradzhyiski for the bug report and the patch);
  • CMYK images support is added (cheers Alexey Buzanov, Guillermo Rauch and https://github.com/a-e-k for the assistance);
  • Grayscale images support is added (thanks https://github.com/a-e-m);
  • LittleCMS is now optional (but it is still required to get proper colors).

0.eight.iv (2013-06-12)

  • Bespeak and Millimeter types are added to UnitFloatType (thanks Doug Ellwanger).

0.viii.3 (2013-06-01)

  • Some issues with descriptor parsing are stock-still (thanks Luke Petre).

0.eight.ii (2013-04-12)

  • Python 2.x: reading data from file-similar objects is fixed (thank you Pavel Zinovkin).

0.viii.1 (2013-03-02)

  • Fixed parsing of layer groups without explicit OPEN_FOLDER marker;
  • Cython extension is rebuilt with Cython 0.18.

0.8 (2013-02-26)

  • Descriptor parsing (thank you Oliver Zheng);
  • text (as cord) is extracted from text layers (cheers Oliver Zheng);
  • improved back up for optional edifice of Cython extension.

0.7.1 (2012-12-27)

  • Typo is fixed: LayerRecord.cilpping should be LayerRecord.clipping. Thanks Oliver Zheng.

0.7 (2012-11-08)

  • Highly experimental: basic layer merging is implemented (e.g. it is at present possible to export layer group to a PIL image);
  • Layer.visible no longer takes group visibility in account;
  • Layer.visible_global is the old Layer.visible;
  • psd_tools.user_api.combined_bbox made public;
  • Layer.width and Layer.peak are removed (apply layer.bbox.width and layer.bbox.elevation instead);
  • pil_support.composite_image_to_PIL is renamed to pil_support.extract_composite_image and pil_support.layer_to_PIL is renamed to pil_support.extract_layer_image in order to accept the same API for pil_support and pymaging_support.

0.6 (2012-11-06)

  • psd.composite_image() is renamed to psd.as_PIL();
  • Pymaging support: psd.as_pymaging() and layer.as_pymaging() methods.

0.5 (2012-11-05)

  • Support for zip and goose egg-with-prediction pinch methods is added;
  • support for sixteen/32bit layers is added;
  • optional Cython extension for faster zilch-with-prediction decompression;
  • other speed improvements.

0.2 (2012-eleven-04)

  • Initial back up for 16bit and 32bit PSD files: psd-tools v0.2 can read blended (merged) images for such files and extract data (names, dimensions, hierarchy, etc.) about layers and groups of 16/32bit PSD; extracting paradigm data for distinct layers in 16/32bit PSD files is non suported yet;
  • better Layer.__repr__;
  • bbox property for Group.

0.ane.4 (2012-xi-01)

Packaging is fixed in this release.

0.one.three (2012-11-01)

  • Better support for 32bit images (still incomplete);
  • reader is able to handle "global" tagged layer info blocks that was previously discarded.

0.1.2 (2012-x-30)

  • warn about 32bit images;
  • transparency support for composite images.

0.1.1 (2012-x-29)

Initial release (v0.1 had packaging issues).

Download files

Download the file for your platform. If you're not certain which to choose, learn more than about installing packages.

Source Distribution

Built Distributions

Source: https://pypi.org/project/psd-tools/

Posted by: rodgersimas1998.blogspot.com

0 Response to "How To Rasterize A Photoshop Layer In Python"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel