table of contents
SRC(1) | psd-tools | SRC(1) |
NAME¶
src - src Documentation
psd-tools is a Python package for working with Adobe Photoshop PSD files as described in specification.
INSTALLATION¶
Use pip to install the package:
pip install psd-tools
NOTE:
GETTING STARTED¶
from psd_tools import PSDImage psd = PSDImage.open('example.psd') psd.composite().save('example.png') for layer in psd:
print(layer)
image = layer.composite()
Check out the Usage documentation for more examples.
Usage¶
Command line¶
The package provides command line tools to handle a PSD document:
psd-tools export <input_file> <output_file> [options] psd-tools show <input_file> [options] psd-tools debug <input_file> [options] psd-tools -h | --help psd-tools --version
Example:
psd-tools show example.psd # Show the file content psd-tools export example.psd example.png # Export as PNG psd-tools export example.psd[0] example-0.png # Export layer as PNG
Working with PSD document¶
psd_tools.api package provides the user-friendly API to work with PSD files. PSDImage represents a PSD file.
Open an image:
from psd_tools import PSDImage psd = PSDImage.open('my_image.psd')
Most of the data structure in the psd-tools suppports pretty printing in IPython environment.
In [1]: PSDImage.open('example.psd') Out[1]: PSDImage(mode=RGB size=101x55 depth=8 channels=3)
[0] PixelLayer('Background' size=101x55)
[1] PixelLayer('Layer 1' size=85x46)
Internal layers are accessible by iterator or indexing:
for layer in psd:
print(layer)
if layer.is_group():
for child in layer:
print(child) child = psd[0][0]
NOTE:
The opened PSD file can be saved:
psd.save('output.psd')
Working with Layers¶
There are various layer kinds in Photoshop.
The most basic layer type is PixelLayer:
print(layer.name) layer.kind == 'pixel'
Some of the layer attributes are editable, such as a layer name:
layer.name = 'Updated layer 1'
NOTE:
Group has internal layers:
for layer in group:
print(layer) first_layer = group[0]
TypeLayer is a layer with texts:
print(layer.text)
ShapeLayer draws a vector shape, and the shape information is stored in vector_mask and origination property. Other layers can also have shape information as a mask:
print(layer.vector_mask) for shape in layer.origination:
print(shape)
SmartObjectLayer embeds or links an external file for non-destructive editing. The file content is accessible via smart_object property:
import io if layer.smart_object.filetype in ('jpg', 'png'):
image = Image.open(io.BytesIO(layer.smart_object.data))
SolidColorFill, PatternFill, and GradientFill are fill layers that paint the entire region if there is no associated mask. Sub-classes of AdjustmentLayer represents layer adjustment applied to the composed image. See Adjustment layers.
Exporting data to PIL¶
Export the entire document as PIL.Image:
image = psd.composite() image.save('exported.png')
Export a single layer including masks and clipping layers:
image = layer.composite()
Export layer and mask separately without composition:
image = layer.topil() mask = layer.mask.topil()
To composite specific layers, such as layers except for texts, use layer_filter option:
image = psd.composite(
layer_filter=lambda layer: layer.is_visible() and layer.kind != 'type')
Note that most of the layer effects and adjustment layers are not supported. The compositing result may look different from Photoshop.
Exporting data to NumPy¶
PSDImage or layers can be exported to NumPy array by numpy() method:
image = psd.numpy() layer_image = layer.numpy()
Migrating to 1.9¶
psd-tools 1.9 switches to NumPy based compositing.
version 1.8.x:
psd = PSDImage.open(filename) image = psd.compose() layer = psd[0] layer_image = layer.compose()
version 1.9.x:
psd = PSDImage.open(filename) image = psd.composite() layer = psd[0] layer_image = layer.composite()
NumPy array API is introduced:
image = psd.numpy() layer_image = layer.numpy()
Migrating to 1.8¶
There are major API changes in version 1.8.x.
NOTE:
PSDImage¶
File open method is changed from load to open().
version 1.7.x:
psd = PSDImage.load(filename) with open(filename, 'rb') as f:
psd = PSDImage.from_stream(f)
version 1.8.x:
psd = PSDImage.open(filename) with open(filename, 'rb') as f:
psd = PSDImage.open(f)
Layers¶
Children of PSDImage or Group is directly accessible by iterator or indexing.
version 1.7.x:
for layer in group.layers:
print(layer) first_child = group.layers[0]
version 1.8.x:
for layer in group:
print(layer) first_child = group[0]
In version 1.8.x, the order of layers is reversed to reflect that the index should not change when a new layer is added on top.
PIL export¶
Primary PIL export method is compose().
version 1.7.x:
image = psd.as_PIL() layer_image = compose(layer) raw_layer_image = layer.as_PIL()
version 1.8.x:
image = psd.compose() layer_image = layer.compose() raw_layer_image = layer.topil()
Low-level data structure¶
Data structures are completely rewritten to support writing functionality. See psd_tools.psd subpackage.
version 1.7.x:
psd.decoded_data
version 1.8.x:
psd._record
Drop pymaging support¶
Pymaging support is dropped.
Contributing¶
Development happens at github: bug tracker. Feel free to submit bug reports or pull requests. Attaching an erroneous PSD file makes the debugging process faster. Such PSD file might be added to the test suite.
The license is MIT.
Package design¶
The package consists of two major subpackages:
- 1.
- psd_tools.psd: subpackage that reads/writes low-level binary
- structure of the PSD/PSB file. The core data structures are built around attrs class that all implement read and write methods. Each data object tries to resemble the structure described in the specification. Although documented, the specification is far from complete and some are even inaccurate. When psd-tools finds unknown data structure, the package keeps such data as bytes in the parsed result.
- 2.
- psd_tools.api: User-facing API that implements various
- easy-to-use methods that manipulate low-level psd_tools.psd data structures.
Testing¶
In order to run tests, make sure PIL/Pillow is built with LittleCMS or LittleCMS2 support. For example, on Ubuntu, install the following packages:
apt-get install liblcms2-dev libjpeg-dev libfreetype6-dev zlib1g-dev
Then install psd-tools with the following command:
pip install -e .[dev]
Finally, run tests with pytest:
pytest
Documentation¶
Install Sphinx to generate documents:
pip install sphinx sphinx_rtd_theme
Once installed, use Makefile:
make docs
Acknowledgments¶
Great thanks to all the contributors.
FEATURES¶
Supported:
- Read and write of the low-level PSD/PSB file structure
- Raw layer image 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 dissolve
- Drawing of bezier curves
Not supported:
- Editing of layer structure, such as adding or removing a layer
- Composition of adjustment layers
- Composition of many layer effects
- Font rendering
psd_tools¶
See Usage for examples.
PSDImage¶
- class psd_tools.PSDImage(data)
- Photoshop PSD/PSB file object.
The low-level data structure is accessible at PSDImage._record.
Example:
from psd_tools import PSDImage psd = PSDImage.open('example.psd') image = psd.compose() for layer in psd:
layer_image = layer.compose()
- property bbox
- Minimal bounding box that contains all the visible layers.
Use viewbox to get viewport bounding box. When the psd is empty, bbox is equal to the canvas bounding box.
- Returns
- (left, top, right, bottom) tuple.
- property color_mode
- Document color mode, such as 'RGB' or 'GRAYSCALE'. See ColorMode.
- Returns
- ColorMode
- property compatibility_mode
- Set the compositing and layer organization compatibility mode. Writable.
- Returns
- CompatibilityMode
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose the PSD image.
- Parameters
- bbox -- Viewport tuple (left, top, right, bottom).
- Returns
- PIL.Image, or None if there is no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, ignore_preview=False, apply_icc=False)
- Composite the PSD image.
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the viewbox of the PSD.
- ignore_preview -- Boolean flag to whether skip compositing when a pre-composited preview is available.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- descendants(include_clip=True)
- Return a generator to iterate over all descendant layers.
Example:
# Iterate over all layers for layer in psd.descendants():
print(layer) # Iterate over all layers in reverse order for layer in reversed(list(psd.descendants())):
print(layer)
- Parameters
- include_clip -- include clipping layers.
- classmethod frompil(image, compression=Compression.RLE)
- Create a new PSD document from PIL Image.
- image -- PIL Image object.
- compression -- ImageData compression option. See Compression.
- Returns
- A PSDImage object.
- has_preview()
- Returns if the document has real merged data. When True, topil() returns pre-composed data.
- has_thumbnail()
- True if the PSDImage has a thumbnail resource.
- property image_resources
- Document image resources. ImageResources is a dict-like structure
that keeps various document settings.
See psd_tools.constants.Resource for available keys.
- Returns
- ImageResources
Example:
from psd_tools.constants import Resource version_info = psd.image_resources.get_data(Resource.VERSION_INFO) slices = psd.image_resources.get_data(Resource.SLICES)
Image resources contain an ICC profile. The following shows how to export a PNG file with embedded ICC profile:
from psd_tools.constants import Resource icc_profile = psd.image_resources.get_data(Resource.ICC_PROFILE) image = psd.compose(apply_icc=False) image.save('output.png', icc_profile=icc_profile)
- classmethod new(mode, size, color=0, depth=8, **kwargs)
- Create a new PSD document.
- mode -- The color mode to use for the new image.
- size -- A tuple containing (width, height) in pixels.
- color -- What color to use for the image. Default is black.
- Returns
- A PSDImage object.
- numpy(channel=None)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray
- classmethod open(fp, **kwargs)
- Open a PSD document.
- fp -- filename or file-like object.
- encoding -- charset encoding of the pascal string within the file, default 'macroman'. Some psd files need explicit encoding option.
- Returns
- A PSDImage object.
- property parent
- Parent of this layer.
- save(fp, mode='wb', **kwargs)
- Save the PSD file.
- fp -- filename or file-like object.
- encoding -- charset encoding of the pascal string within the file, default 'macroman'.
- mode -- file open mode, default 'wb'.
- property tagged_blocks
- Document tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag patterns = psd.tagged_blocks.get_data(Tag.PATTERNS1)
- thumbnail()
- Returns a thumbnail image in PIL.Image. When the file does not contain an embedded thumbnail image, returns None.
- topil(channel=None, apply_icc=False)
- Get PIL Image.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the composed image is not available.
psd_tools.api.adjustments¶
Adjustment and fill layers.
Example:
if layer.kind == 'brightnesscontrast':
print(layer.brightness) if layer.kind == 'gradientfill':
print(layer.gradient_kind)
Fill layers¶
Fill layers are similar to ShapeLayer except that the layer might not have an associated vector mask. The layer therefore expands the entire canvas of the PSD document.
Fill layers all inherit from FillLayer.
Example:
if isinstance(layer, psd_tools.layers.FillLayer):
image = layer.compose()
SolidColorFill¶
- class psd_tools.api.adjustments.SolidColorFill(*args)
- Solid color fill.
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- property data
- Color in Descriptor(RGB).
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
PatternFill¶
- class psd_tools.api.adjustments.PatternFill(*args)
- Pattern fill.
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- property data
- Pattern in Descriptor(PATTERN).
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
GradientFill¶
- class psd_tools.api.adjustments.GradientFill(*args)
- Gradient fill.
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- property data
- Gradient in Descriptor(GRADIENT).
- property gradient_kind
- Kind of the gradient, one of the following:
- Linear
- Radial
- Angle
- Reflected
- Diamond
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Adjustment layers¶
Adjustment layers apply image filtering to the composed result. All adjustment layers inherit from AdjustmentLayer. Adjustment layers do not have pixels, and currently ignored in compose. Attempts to call topil on adjustment layers always return None.
Just as any other layer, adjustment layers might have an associated mask or vector mask. Adjustment can appear in other layers' clipping layers.
Example:
if isinstance(layer, psd_tools.layers.AdjustmentLayer):
print(layer.kind)
BrightnessContrast¶
Curves¶
Exposure¶
Levels¶
- class psd_tools.api.adjustments.Levels(*args)
- Levels adjustment.
Levels contain a list of LevelRecord.
- property master
- Master record.
Vibrance¶
HueSaturation¶
- class psd_tools.api.adjustments.HueSaturation(*args)
- Hue/Saturation adjustment.
HueSaturation contains a list of data.
ColorBalance¶
BlackAndWhite¶
PhotoFilter¶
ChannelMixer¶
ColorLookup¶
- class psd_tools.api.adjustments.ColorLookup(*args)
- Color lookup adjustment.
Posterize¶
- class psd_tools.api.adjustments.Posterize(*args)
- Posterize adjustment.
Threshold¶
- class psd_tools.api.adjustments.Threshold(*args)
- Threshold adjustment.
SelectiveColor¶
GradientMap¶
- class psd_tools.api.adjustments.GradientMap(*args)
- Gradient map adjustment.
- property interpolation
- Interpolation between 0.0 and 1.0.
psd_tools.api.effects¶
Effects module.
- class psd_tools.api.effects.Effects(layer)
- List-like effects.
- find(name)
- Iterate effect items by name.
- property scale
- Scale value.
DropShadow¶
- property angle
- Angle value.
- property anti_aliased
- Angi-aliased.
- property blend_mode
- Effect blending mode.
- property choke
- Choke level.
- property color
- Color.
- property contour
- Contour configuration.
- property distance
- Distance.
- property enabled
- Whether if the effect is enabled.
- property layer_knocks_out
- Layers are knocking out.
- property noise
- Noise level.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size in pixels.
- property use_global_light
- Using global light.
InnerShadow¶
- property angle
- Angle value.
- property anti_aliased
- Angi-aliased.
- property blend_mode
- Effect blending mode.
- property choke
- Choke level.
- property color
- Color.
- property contour
- Contour configuration.
- property distance
- Distance.
- property enabled
- Whether if the effect is enabled.
- property noise
- Noise level.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size in pixels.
- property use_global_light
- Using global light.
OuterGlow¶
- property angle
- Angle value.
- property anti_aliased
- Angi-aliased.
- property blend_mode
- Effect blending mode.
- property choke
- Choke level.
- property color
- Color.
- property contour
- Contour configuration.
- property dithered
- Dither flag.
- property enabled
- Whether if the effect is enabled.
- property glow_type
- Glow type.
- property gradient
- Gradient configuration.
- property noise
- Noise level.
- property offset
- Offset value.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property quality_jitter
- Quality jitter
- property quality_range
- Quality range.
- property reversed
- Reverse flag.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size in pixels.
- property type
- Gradient type, one of linear, radial, angle, reflected, or diamond.
InnerGlow¶
- property angle
- Angle value.
- property anti_aliased
- Angi-aliased.
- property blend_mode
- Effect blending mode.
- property choke
- Choke level.
- property color
- Color.
- property contour
- Contour configuration.
- property dithered
- Dither flag.
- property enabled
- Whether if the effect is enabled.
- property glow_source
- Elements source.
- property glow_type
- Glow type.
- property gradient
- Gradient configuration.
- property noise
- Noise level.
- property offset
- Offset value.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property quality_jitter
- Quality jitter
- property quality_range
- Quality range.
- property reversed
- Reverse flag.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size in pixels.
- property type
- Gradient type, one of linear, radial, angle, reflected, or diamond.
ColorOverlay¶
- property blend_mode
- Effect blending mode.
- property color
- Color.
- property enabled
- Whether if the effect is enabled.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property shown
- Whether if the effect is shown in dialog.
GradientOverlay¶
- property aligned
- Aligned.
- property angle
- Angle value.
- property blend_mode
- Effect blending mode.
- property dithered
- Dither flag.
- property enabled
- Whether if the effect is enabled.
- property gradient
- Gradient configuration.
- property offset
- Offset value.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property reversed
- Reverse flag.
- property scale
- Scale value.
- property shown
- Whether if the effect is shown in dialog.
- property type
- Gradient type, one of linear, radial, angle, reflected, or diamond.
PatternOverlay¶
- property aligned
- Aligned.
- property angle
- Angle value.
- property blend_mode
- Effect blending mode.
- property enabled
- Whether if the effect is enabled.
- property linked
- Linked.
- property opacity
- Layer effect opacity in percentage.
- property pattern
- Pattern config.
- property phase
- Phase value in Point.
- property present
- Whether if the effect is present in Photoshop UI.
- property scale
- Scale value.
- property shown
- Whether if the effect is shown in dialog.
Stroke¶
- property angle
- Angle value.
- property blend_mode
- Effect blending mode.
- property color
- Color.
- property dithered
- Dither flag.
- property enabled
- Whether if the effect is enabled.
- property fill_type
- Fill type, SolidColor, Gradient, or Pattern.
- property gradient
- Gradient configuration.
- property linked
- Linked.
- property offset
- Offset value.
- property opacity
- Layer effect opacity in percentage.
- property overprint
- Overprint flag.
- property pattern
- Pattern config.
- property phase
- Phase value in Point.
- property position
- Position of the stroke, InsetFrame, OutsetFrame, or CenteredFrame.
- property present
- Whether if the effect is present in Photoshop UI.
- property reversed
- Reverse flag.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size value.
- property type
- Gradient type, one of linear, radial, angle, reflected, or diamond.
BevelEmboss¶
- property altitude
- Altitude value.
- property angle
- Angle value.
- property anti_aliased
- Anti-aliased.
- property bevel_style
- Bevel style, one of OuterBevel, InnerBevel, Emboss, PillowEmboss, or StrokeEmboss.
- property bevel_type
- Bevel type, one of SoftMatte, HardLight, SoftLight.
- property contour
- Contour configuration.
- property depth
- Depth value.
- property direction
- Direction, either StampIn or StampOut.
- property enabled
- Whether if the effect is enabled.
- property highlight_color
- Highlight color value.
- property highlight_mode
- Highlight blending mode.
- property highlight_opacity
- Highlight opacity value.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property shadow_color
- Shadow color value.
- property shadow_mode
- Shadow blending mode.
- property shadow_opacity
- Shadow opacity value.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size value in pixel.
- property soften
- Soften value.
- property use_global_light
- Using global light.
- property use_shape
- Using shape.
- property use_texture
- Using texture.
Satin¶
- property angle
- Angle value.
- property anti_aliased
- Anti-aliased.
- property blend_mode
- Effect blending mode.
- property color
- Color.
- property contour
- Contour configuration.
- property distance
- Distance value.
- property enabled
- Whether if the effect is enabled.
- property inverted
- Inverted.
- property opacity
- Layer effect opacity in percentage.
- property present
- Whether if the effect is present in Photoshop UI.
- property shown
- Whether if the effect is shown in dialog.
- property size
- Size value in pixel.
psd_tools.api.layers¶
Layer module.
Artboard¶
- class psd_tools.api.layers.Artboard(*args)
- Artboard is a special kind of group that has a pre-defined viewbox.
Example:
artboard = psd[1] image = artboard.compose()
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(bbox=None, **kwargs)
- Compose the artboard.
See compose() for available extra arguments.
- Parameters
- bbox -- Viewport tuple (left, top, right, bottom).
- Returns
- PIL.Image, or None if there is no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- descendants(include_clip=True)
- Return a generator to iterate over all descendant layers.
Example:
# Iterate over all layers for layer in psd.descendants():
print(layer) # Iterate over all layers in reverse order for layer in reversed(list(psd.descendants())):
print(layer)
- Parameters
- include_clip -- include clipping layers.
- static extract_bbox(layers, include_invisible=False)
- Returns a bounding box for layers or (0, 0, 0, 0) if the layers have no bounding box.
- Parameters
- include_invisible -- include invisible layers in calculation.
- Returns
- tuple of four int
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Group¶
- class psd_tools.api.layers.Group(*args)
- Group of layers.
Example:
group = psd[1] for layer in group:
if layer.kind == 'pixel':
print(layer.name)
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None, context=None, color=None)
- Compose layer and masks (mask, vector mask, and clipping layers).
- Returns
- PIL Image object, or None if the layer has no pixels.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- descendants(include_clip=True)
- Return a generator to iterate over all descendant layers.
Example:
# Iterate over all layers for layer in psd.descendants():
print(layer) # Iterate over all layers in reverse order for layer in reversed(list(psd.descendants())):
print(layer)
- Parameters
- include_clip -- include clipping layers.
- static extract_bbox(layers, include_invisible=False)
- Returns a bounding box for layers or (0, 0, 0, 0) if the layers have no bounding box.
- Parameters
- include_invisible -- include invisible layers in calculation.
- Returns
- tuple of four int
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
PixelLayer¶
- class psd_tools.api.layers.PixelLayer(psd, record, channels, parent)
- Layer that has rasterized image in pixels.
Example:
assert layer.kind == 'pixel': image = layer.topil() image.save('layer.png') composed_image = layer.compose() composed_image.save('composed-layer.png')
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
ShapeLayer¶
- class psd_tools.api.layers.ShapeLayer(psd, record, channels, parent)
- Layer that has drawing in vector mask.
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
SmartObjectLayer¶
- class psd_tools.api.layers.SmartObjectLayer(psd, record, channels, parent)
- Layer that inserts external data.
Use smart_object attribute to get the external data. See SmartObject.
Example:
import io if layer.smart_object.filetype == 'jpg':
image = Image.open(io.BytesIO(layer.smart_object.data))
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
TypeLayer¶
- class psd_tools.api.layers.TypeLayer(*args)
- Layer that has text and styling information for fonts or paragraphs.
Text is accessible at text property. Styling information for paragraphs is in engine_dict. Document styling information such as font list is is resource_dict.
Currently, textual information is read-only.
Example:
if layer.kind == 'type':
print(layer.text)
print(layer.engine_dict['StyleRun'])
# Extract font for each substring in the text.
text = layer.engine_dict['Editor']['Text'].value
fontset = layer.resource_dict['FontSet']
runlength = layer.engine_dict['StyleRun']['RunLengthArray']
rundata = layer.engine_dict['StyleRun']['RunArray']
index = 0
for length, style in zip(runlength, rundata):
substring = text[index:index + length]
stylesheet = style['StyleSheet']['StyleSheetData']
font = fontset[stylesheet['Font']]
print('%r gets %s' % (substring, font))
index += length
- property bbox
- (left, top, right, bottom) tuple.
- property blend_mode
- Blend mode of this layer. Writable.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
- Returns
- BlendMode.
- property clip_layers
- Clip layers associated with this layer.
To compose clipping layers:
from psd_tools import compose clip_mask = compose(layer.clip_layers)
- Returns
- list of layers
- compose(force=False, bbox=None, layer_filter=None)
- Deprecated, use composite().
Compose layer and masks (mask, vector mask, and clipping layers).
Note that the resulting image size is not necessarily equal to the layer size due to different mask dimensions. The offset of the composed image is stored at .info['offset'] attribute of PIL.Image.
- Parameters
- bbox -- Viewport bounding box specified by (x1, y1, x2, y2) tuple.
- Returns
- PIL.Image, or None if the layer has no pixel.
- composite(viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, apply_icc=False)
- Composite layer and masks (mask, vector mask, and clipping layers).
- viewport -- Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox.
- force -- Boolean flag to force vector drawing.
- color -- Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode.
- alpha -- Backdrop alpha in [0.0, 1.0].
- layer_filter -- Callable that takes a layer as argument and returns whether if the layer is composited. Default is is_visible().
- Returns
- PIL.Image.
- property document_resources
- Resource set relevant to the document.
- property engine_dict
- Styling information dict.
- has_pixels()
- Returns True if the layer has associated pixels. When this is True, topil method returns PIL.Image.
- Returns
- bool
- has_stroke()
- Returns True if the shape has a stroke.
- property kind
- Kind of this layer, such as group, pixel, shape, type, smartobject, or psdimage. Class name without layer suffix.
- Returns
- str
- numpy(channel=None, real_mask=True)
- Get NumPy array of the layer.
- Parameters
- channel -- Which channel to return, can be 'color', 'shape', 'alpha', or 'mask'. Default is 'color+alpha'.
- Returns
- numpy.ndarray or None if there is no pixel.
- property origination
- Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that are Photoshop feature to handle primitive shapes such as a rectangle, an ellipse, or a line. Vector masks without live shape properties are plain path objects.
See psd_tools.api.shape.
- Returns
- List of Invalidated, Rectangle, RoundedRectangle, Ellipse, or Line.
- property parent
- Parent of this layer.
- property resource_dict
- Resource set.
- property stroke
- Property for strokes.
- property tagged_blocks
- Layer tagged blocks that is a dict-like container of settings.
See psd_tools.constants.Tag for available keys.
- Returns
- TaggedBlocks or None.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
- property text_type
- Text type. Read-only.
- psd_tools.constants.TextType.POINT for point type text (also known as character type)
- psd_tools.constants.TextType.PARAGRAPH for paragraph type text (also known as area type)
- None if text type cannot be determined or information is unavailable
See psd_tools.constants.TextType.
- topil(channel=None, apply_icc=False)
- Get PIL Image of the layer.
- channel -- Which channel to return; e.g., 0 for 'R' channel in RGB image. See ChannelID. When None, the method returns all the channels supported by PIL modes.
- apply_icc -- Whether to apply ICC profile conversion to sRGB.
- Returns
- PIL.Image, or None if the layer has no pixels.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
- property transform
- Matrix (xx, xy, yx, yy, tx, ty) applies affine transformation.
- property warp
- Warp configuration.
psd_tools.api.mask¶
Mask module.
Mask¶
- class psd_tools.api.mask.Mask(layer)
- Mask data attached to a layer.
There are two distinct internal mask data: user mask and vector mask. User mask refers any pixel-based mask whereas vector mask refers a mask from a shape path. Internally, two masks are combined and referred real mask.
- property background_color
- Background color.
- property bbox
- BBox
- property bottom
- Bottom coordinate.
- property disabled
- Disabled.
- property flags
- Flags.
- property height
- Height.
- property left
- Left coordinate.
- property parameters
- Parameters.
- property real_flags
- Real flag.
- property right
- Right coordinate.
- property size
- (Width, Height) tuple.
- property top
- Top coordinate.
- topil(real=True, **kwargs)
- Get PIL Image of the mask.
- Parameters
- real -- When True, returns pixel + vector mask combined.
- Returns
- PIL Image object, or None if the mask is empty.
- property width
- Width.
psd_tools.api.shape¶
Shape module.
In PSD/PSB, shapes are all represented as VectorMask in each layer, and optionally there might be Origination object to control live shape properties and Stroke to specify how outline is stylized.
VectorMask¶
- class psd_tools.api.shape.VectorMask(data)
- Vector mask data.
Vector mask is a resolution-independent mask that consists of one or more Path objects. In Photoshop, all the path objects are represented as Bezier curves. Check paths property for how to deal with path objects.
- property bbox
- Bounding box tuple (left, top, right, bottom) in relative coordinates, where top-left corner is (0., 0.) and bottom-right corner is (1., 1.).
- Returns
- tuple
- property clipboard_record
- Clipboard record containing bounding box information.
Depending on the Photoshop version, this field can be None.
- property disabled
- If the mask is disabled.
- property initial_fill_rule
- Initial fill rule.
When 0, fill inside of the path. When 1, fill outside of the shape.
- Returns
- int
- property inverted
- Invert the mask.
- property not_linked
- If the knots are not linked.
- property paths
- List of Subpath. Subpath is a list-like structure that contains one
or more Knot items. Knot contains relative coordinates of control
points for a Bezier curve. index indicates which origination item
the subpath belongs, and operation indicates how to combine
multiple shape paths.
In PSD, path fill rule is even-odd.
Example:
for subpath in layer.vector_mask.paths:
anchors = [(
int(knot.anchor[1] * psd.width),
int(knot.anchor[0] * psd.height),
) for knot in subpath]
- Returns
- List of Subpath.
Stroke¶
- class psd_tools.api.shape.Stroke(data)
- Stroke contains decorative information for strokes.
This is a thin wrapper around Descriptor structure. Check _data attribute to get the raw data.
- property blend_mode
- Blend mode.
- property content
- Fill effect.
- property enabled
- If the stroke is enabled.
- property fill_enabled
- If the stroke fill is enabled.
- property line_alignment
- Alignment, one of inner, outer, center.
- property line_cap_type
- Cap type, one of butt, round, square.
- property line_join_type
- Join type, one of miter, round, bevel.
- property line_width
- Stroke width in float.
- property miter_limit
- Miter limit in float.
- property opacity
- Opacity value.
- property stroke_adjust
- Stroke adjust
Origination¶
Origination keeps live shape properties for some of the primitive shapes. Origination objects are accessible via origination property of layers. Following primitive shapes are defined: Invalidated, Line, Rectangle, Ellipse, and RoundedRectangle.
Invalidated¶
- class psd_tools.api.shape.Invalidated(data)
- Invalidated live shape.
This equals to a primitive shape that does not provide Live shape properties. Use VectorMask to access shape information instead of this origination object.
Line¶
- class psd_tools.api.shape.Line(data)
- Line live shape.
- property origin_type
- Type of the vector shape.
- 1: Rectangle
- 2: RoundedRectangle
- 4: Line
- 5: Ellipse
- Returns
- int
Ellipse¶
- class psd_tools.api.shape.Ellipse(data)
- Ellipse live shape.
- property origin_type
- Type of the vector shape.
- 1: Rectangle
- 2: RoundedRectangle
- 4: Line
- 5: Ellipse
- Returns
- int
Rectangle¶
- class psd_tools.api.shape.Rectangle(data)
- Rectangle live shape.
- property origin_type
- Type of the vector shape.
- 1: Rectangle
- 2: RoundedRectangle
- 4: Line
- 5: Ellipse
- Returns
- int
RoundedRectangle¶
- class psd_tools.api.shape.RoundedRectangle(data)
- Rounded rectangle live shape.
- property origin_type
- Type of the vector shape.
- 1: Rectangle
- 2: RoundedRectangle
- 4: Line
- 5: Ellipse
- Returns
- int
- property radii
- Corner radii of rounded rectangles. The order is top-left, top-right, bottom-left, bottom-right.
- Returns
- Descriptor
psd_tools.api.smart_object¶
Smart object module.
SmartObject¶
- class psd_tools.api.smart_object.SmartObject(layer)
- Smart object that represents embedded or external file.
Smart objects are attached to SmartObjectLayer.
- property data
- Embedded file content, or empty if kind is external or alias
- property filename
- Original file name of the object.
- property filesize
- File size of the object.
- property filetype
- Preferred file extension, such as jpg.
- is_psd()
- Return True if the file is embedded PSD/PSB.
- property kind
- Kind of the link, 'data', 'alias', or 'external'.
- open(external_dir=None)
- Open the smart object as binary IO.
- Parameters
- external_dir -- Path to the directory of the external file.
Example:
with layer.smart_object.open() as f:
data = f.read()
- property resolution
- Resolution of the object.
- save(filename=None)
- Save the smart object to a file.
- Parameters
- filename -- File name to export. If None, use the embedded name.
- property transform_box
- A tuple representing the coordinates of the smart objects's transformed
box. This box is the result of one or more transformations such as
scaling, rotation, translation, or skewing to the original bounding box of
the smart object.
The format of the tuple is as follows: (x1, y1, x2, y2, x3, y3, x4, y4)
Where 1 is top left corner, 2 is top right, 3 is bottom right and 4 is bottom left.
- property unique_id
- UUID of the object.
- property warp
- Warp parameters.
psd_tools.constants¶
Various constants for psd_tools
BlendMode¶
ChannelID¶
- class psd_tools.constants.ChannelID(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Channel types.
Clipping¶
ColorMode¶
ColorSpaceID¶
- class psd_tools.constants.ColorSpaceID(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Color space types.
Compression¶
- class psd_tools.constants.Compression(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Compression modes.
Compression. 0 = Raw Data, 1 = RLE compressed, 2 = ZIP without prediction, 3 = ZIP with prediction.
EffectOSType¶
- class psd_tools.constants.EffectOSType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- OS Type keys for Layer Effects.
GlobalLayerMaskKind¶
- class psd_tools.constants.GlobalLayerMaskKind(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Global layer mask kind.
LinkedLayerType¶
- class psd_tools.constants.LinkedLayerType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Linked layer types.
PathResourceID¶
PlacedLayerType¶
PrintScaleStyle¶
- class psd_tools.constants.PrintScaleStyle(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Print scale style.
Resource¶
- class psd_tools.constants.Resource(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Image resource keys.
Note the following is not defined for performance reasons.
- PATH_INFO_10 to PATH_INFO_989 corresponding to 2010 - 2989
SectionDivider¶
Tag¶
- class psd_tools.constants.Tag(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Tagged blocks keys.
TextType¶
psd_tools.psd¶
Low-level API that translates binary data to Python structure.
All the data structure in this subpackage inherits from one of the object defined in psd_tools.psd.base module.
PSD¶
- class psd_tools.psd.PSD(header=NOTHING, color_mode_data=NOTHING, image_resources=NOTHING, layer_and_mask_information=NOTHING, image_data=NOTHING)
- Low-level PSD file structure that resembles the specification.
Example:
from psd_tools.psd import PSD with open(input_file, 'rb') as f:
psd = PSD.read(f) with open(output_file, 'wb') as f:
psd.write(f)
- header
- See FileHeader.
- color_mode_data
- See ColorModeData.
- image_resources
- See ImageResources.
- layer_and_mask_information
- See LayerAndMaskInformation.
- image_data
- See ImageData.
psd_tools.psd.base¶
Base data structures intended for inheritance.
All the data objects in this subpackage inherit from the base classes here. That means, all the data structures in the psd_tools.psd subpackage implements the methods of BaseElement for serialization and decoding.
Objects that inherit from the BaseElement typically gets attrs decoration to have data fields.
BaseElement¶
- class psd_tools.psd.base.BaseElement
- Base element of various PSD file structs. All the data objects in psd_tools.psd subpackage inherit from this class.
- classmethod read(cls, fp)
- Read the element from a file-like object.
- write(self, fp)
- Write the element to a file-like object.
- classmethod frombytes(self, data, *args, **kwargs)
- Read the element from bytes.
- tobytes(self, *args, **kwargs)
- Write the element to bytes.
- validate(self)
- Validate the attribute.
EmptyElement¶
- class psd_tools.psd.base.EmptyElement
- Empty element that does not have a value.
ValueElement¶
- class psd_tools.psd.base.ValueElement(value=None)
- Single value wrapper that has a value attribute.
Pretty printing shows the internal value by default. Inherit with @attr.s(repr=False) decorator to keep this behavior.
- value
- Internal value.
NumericElement¶
- class psd_tools.psd.base.NumericElement(value=0.0)
- Single value element that has a numeric value attribute.
IntegerElement¶
- class psd_tools.psd.base.IntegerElement(value=0)
- Single integer value element that has a value attribute.
Use with @attr.s(repr=False) decorator.
ShortIntegerElement¶
- class psd_tools.psd.base.ShortIntegerElement(value=0)
- Single short integer element that has a value attribute.
Use with @attr.s(repr=False) decorator.
ByteElement¶
- class psd_tools.psd.base.ByteElement(value=0)
- Single 1-byte integer element that has a value attribute.
Use with @attr.s(repr=False) decorator.
BooleanElement¶
- class psd_tools.psd.base.BooleanElement(value=False)
- Single bool value element that has a value attribute.
Use with @attr.s(repr=False) decorator.
StringElement¶
ListElement¶
- class psd_tools.psd.base.ListElement(items=NOTHING)
- List-like element that has items list.
DictElement¶
- class psd_tools.psd.base.DictElement(items=NOTHING)
- Dict-like element that has items OrderedDict.
psd_tools.psd.color_mode_data¶
Color mode data structure.
ColorModeData¶
- class psd_tools.psd.color_mode_data.ColorModeData(value: bytes = b'')
- Color mode data section of the PSD file.
For indexed color images the data is the color table for the image in a non-interleaved order.
Duotone images also have this data, but the data format is undocumented.
- interleave()
- Returns interleaved color table in bytes.
psd_tools.psd.descriptor¶
Descriptor data structure.
Descriptors are basic data structure used throughout PSD files. Descriptor is one kind of serialization protocol for data objects, and enum classes in psd_tools.terminology or bytes indicates what kind of descriptor it is.
The class ID can be pre-defined enum if the tag is 4-byte length or plain bytes if the length is arbitrary. They depend on the internal version of Adobe Photoshop but the detail is unknown.
Pretty printing is the best approach to check the descriptor content:
from IPython.pretty import pprint pprint(descriptor)
Alias¶
- class psd_tools.psd.descriptor.Alias(value: bytes = b'\x00\x00\x00\x00')
- Alias structure equivalent to RawData.
Bool¶
Class¶
- class psd_tools.psd.descriptor.Class(name: str = '', classID: bytes = b'\x00\x00\x00\x00')
- Class structure.
- name
- str value
- classID
- bytes in Klass
Class1¶
- class psd_tools.psd.descriptor.Class1(name: str = '', classID: bytes = b'\x00\x00\x00\x00')
- Class structure equivalent to Class.
Class2¶
- class psd_tools.psd.descriptor.Class2(name: str = '', classID: bytes = b'\x00\x00\x00\x00')
- Class structure equivalent to Class.
Class3¶
- class psd_tools.psd.descriptor.Class3(name: str = '', classID: bytes = b'\x00\x00\x00\x00')
- Class structure equivalent to Class.
Descriptor¶
- class psd_tools.psd.descriptor.Descriptor(items=NOTHING, name: str = '', classID=b'null')
- Dict-like descriptor structure.
Key values can be 4-character bytes in Key or arbitrary length bytes. Supports direct access by Key.
Example:
from psd_tools.terminology import Key descriptor[Key.Enabled] for key in descriptor:
print(descriptor[key])
- name
- str
- classID
- bytes in Klass
Double¶
Enumerated¶
- class psd_tools.psd.descriptor.Enumerated(typeID: bytes = b'\x00\x00\x00\x00', enum: bytes = b'\x00\x00\x00\x00')
- Enum structure.
- typeID
- bytes in Type
- enum
- bytes in Enum
- get_name()
- Get enum name.
EnumeratedReference¶
- class psd_tools.psd.descriptor.EnumeratedReference(name: str = '', classID: bytes = b'\x00\x00\x00\x00', typeID: bytes = b'\x00\x00\x00\x00', enum: bytes = b'\x00\x00\x00\x00')
- Enumerated reference structure.
- name
- str value
- classID
- bytes in Klass
- typeID
- bytes in Type
- enum
- bytes in Enum
GlobalObject¶
- class psd_tools.psd.descriptor.GlobalObject(items=NOTHING, name: str = '', classID=b'null')
- Global object structure equivalent to Descriptor.
Identifier¶
- class psd_tools.psd.descriptor.Identifier(value=0)
- Identifier equivalent to Integer.
Index¶
- class psd_tools.psd.descriptor.Index(value=0)
- Index equivalent to Integer.
Integer¶
LargeInteger¶
List¶
- class psd_tools.psd.descriptor.List(items=NOTHING)
- List structure.
Example:
for item in list_value:
print(item)
Name¶
- class psd_tools.psd.descriptor.Name(name: str = '', classID: bytes = b'\x00\x00\x00\x00', value: str = '')
- Name structure (Undocumented).
- name
- str
- classID
- bytes in Klass
- value
- str
ObjectArray¶
- class psd_tools.psd.descriptor.ObjectArray(items=NOTHING, items_count: int = 0, name: str = '', classID=b'null')
- Object array structure almost equivalent to Descriptor.
- items_count
- int value
- name
- str value
- classID
- bytes in Klass
Property¶
- class psd_tools.psd.descriptor.Property(name: str = '', classID: bytes = b'\x00\x00\x00\x00', keyID: bytes = b'\x00\x00\x00\x00')
- Property structure.
- name
- str value
- classID
- bytes in Klass
- keyID
- bytes in Key
Offset¶
- class psd_tools.psd.descriptor.Offset(name: str = '', classID: bytes = b'\x00\x00\x00\x00', value=0)
- Offset structure.
- name
- str value
- classID
- bytes in Klass
- value
- int value
Path¶
- class psd_tools.psd.descriptor.Path(value: bytes = b'\x00\x00\x00\x00')
- Undocumented path structure equivalent to RawData.
RawData¶
- class psd_tools.psd.descriptor.RawData(value: bytes = b'\x00\x00\x00\x00')
- RawData structure.
- value
- bytes value
Reference¶
- class psd_tools.psd.descriptor.Reference(items=NOTHING)
- Reference structure equivalent to List.
String¶
UnitFloat¶
- class psd_tools.psd.descriptor.UnitFloat(value: float = 0.0, unit=Unit._None)
- Unit float structure.
- unit
- unit of the value in Unit or Enum
- value
- float value
UnitFloats¶
- class psd_tools.psd.descriptor.UnitFloats(unit=Unit._None, values=NOTHING)
- Unit floats structure.
- unit
- unit of the value in Unit or Enum
- values
- List of float values
psd_tools.psd.engine_data¶
EngineData structure.
PSD file embeds text formatting data in its own markup language referred EngineData. The format looks like the following:
<<
/EngineDict
<<
/Editor
<<
/Text (˛ˇMake a change and save.)
>>
>>
/Font
<<
/Name (˛ˇHelveticaNeue-Light)
/FillColor
<<
/Type 1
/Values [ 1.0 0.0 0.0 0.0 ]
>>
/StyleSheetSet [
<<
/Name (˛ˇNormal RGB)
>>
]
>> >>
EngineData¶
- class psd_tools.psd.engine_data.EngineData(items=NOTHING)
- Dict-like element.
TYPE_TOOL_OBJECT_SETTING tagged block contains this object in its descriptor.
EngineData2¶
- class psd_tools.psd.engine_data.EngineData2(items=NOTHING)
- Dict-like element.
TEXT_ENGINE_DATA tagged block has this object.
Bool¶
- class psd_tools.psd.engine_data.Bool(value=False)
- Bool element.
Dict¶
- class psd_tools.psd.engine_data.Dict(items=NOTHING)
- Dict-like element.
Float¶
- class psd_tools.psd.engine_data.Float(value=0.0)
- Float element.
Integer¶
- class psd_tools.psd.engine_data.Integer(value=0)
- Integer element.
List¶
- class psd_tools.psd.engine_data.List(items=NOTHING)
- List-like element.
Property¶
- class psd_tools.psd.engine_data.Property(value=None)
- Property element.
String¶
- class psd_tools.psd.engine_data.String(value=None)
- String element.
psd_tools.psd.effects_layer¶
Effects layer structure.
Note the structures in this module is obsolete and object-based layer effects are stored in tagged blocks.
EffectsLayer¶
- class psd_tools.psd.effects_layer.EffectsLayer(items=NOTHING, version: int = 0)
- Dict-like EffectsLayer structure. See psd_tools.constants.EffectOSType for available keys.
CommonStateInfo¶
- class psd_tools.psd.effects_layer.CommonStateInfo(version: int = 0, visible: int = 1)
- Effects layer common state info.
ShadowInfo¶
OuterGlowInfo¶
- class psd_tools.psd.effects_layer.OuterGlowInfo(version: int = 0, blur: int = 0, intensity: int = 0, color=NOTHING, blend_mode=BlendMode.NORMAL, enabled: int = 0, opacity: int = 0, native_color=None)
- Effects layer outer glow info.
InnerGlowInfo¶
- class psd_tools.psd.effects_layer.InnerGlowInfo(version: int = 0, blur: int = 0, intensity: int = 0, color=NOTHING, blend_mode=BlendMode.NORMAL, enabled: int = 0, opacity: int = 0, invert=None, native_color=None)
- Effects layer inner glow info.
BevelInfo¶
SolidFillInfo¶
- class psd_tools.psd.effects_layer.SolidFillInfo(version: int = 2, blend_mode=BlendMode.NORMAL, color=NOTHING, opacity: int = 0, enabled: int = 0, native_color=NOTHING)
- Effects layer inner glow info.
psd_tools.psd.filter_effects¶
Filter effects structure.
FilterEffects¶
- class psd_tools.psd.filter_effects.FilterEffects(items=NOTHING, version: int = 1)
- List-like FilterEffects structure. See FilterEffect.
FilterEffect¶
- class psd_tools.psd.filter_effects.FilterEffect(uuid=None, version=None, rectangle=None, depth=None, max_channels=None, channels=None, extra=None)
- FilterEffect structure.
- channels
- List of FilterEffectChannel.
- extra
- See FilterEffectExtra.
FilterEffectChannel¶
- class psd_tools.psd.filter_effects.FilterEffectChannel(is_written=0, compression=None, data=b'')
- FilterEffectChannel structure.
FilterEffectExtra¶
- class psd_tools.psd.filter_effects.FilterEffectExtra(is_written=0, rectangle=NOTHING, compression: int = 0, data: bytes = b'')
- FilterEffectExtra structure.
psd_tools.psd.header¶
File header structure.
FileHeader¶
- class psd_tools.psd.header.FileHeader(signature: bytes = b'8BPS', version: int = 1, channels: int = 4, height: int = 64, width: int = 64, depth: int = 8, color_mode=ColorMode.RGB)
- Header section of the PSD file.
Example:
from psd_tools.psd.header import FileHeader from psd_tools.constants import ColorMode header = FileHeader(channels=2, height=359, width=400, depth=8,
color_mode=ColorMode.GRAYSCALE)
- signature
- Signature: always equal to b'8BPS'.
- version
- Version number. PSD is 1, and PSB is 2.
- channels
- The number of channels in the image, including any user-defined alpha channel.
- height
- The height of the image in pixels.
- width
- The width of the image in pixels.
- depth
- The number of bits per channel.
- color_mode
- The color mode of the file. See ColorMode
psd_tools.psd.image_data¶
Image data section structure.
ImageData corresponds to the last section of the PSD/PSB file where a composited image is stored. When the file does not contain layers, this is the only place pixels are saved.
ImageData¶
- class psd_tools.psd.image_data.ImageData(compression=Compression.RAW, data: bytes = b'')
- Merged channel image data.
- compression
- See Compression.
- data
- bytes as compressed in the compression flag.
- get_data(header, split=True)
- Get decompressed data.
- Parameters
- header -- See FileHeader.
- Returns
- list of bytes corresponding each channel.
- classmethod new(header, color=0, compression=Compression.RAW)
- Create a new image data object.
- header -- FileHeader.
- compression -- compression type.
- color -- default color. int or iterable for channel length.
- set_data(data, header)
- Set raw data and compress.
- data -- list of raw data bytes corresponding channels.
- compression -- compression type, see Compression.
- header -- See FileHeader.
- Returns
- length of compressed data.
psd_tools.psd.image_resources¶
Image resources section structure. Image resources are used to store non-pixel data associated with images, such as pen tool paths or slices.
See Resource to check available resource names.
Example:
from psd_tools.constants import Resource version_info = psd.image_resources.get_data(Resource.VERSION_INFO)
The following resources are plain bytes:
Resource.OBSOLETE1: 1000 Resource.MAC_PRINT_MANAGER_INFO: 1001 Resource.MAC_PAGE_FORMAT_INFO: 1002 Resource.OBSOLETE2: 1003 Resource.DISPLAY_INFO_OBSOLETE: 1007 Resource.BORDER_INFO: 1009 Resource.DUOTONE_IMAGE_INFO: 1018 Resource.EFFECTIVE_BW: 1019 Resource.OBSOLETE3: 1020 Resource.EPS_OPTIONS: 1021 Resource.QUICK_MASK_INFO: 1022 Resource.OBSOLETE4: 1023 Resource.WORKING_PATH: 1025 Resource.OBSOLETE5: 1027 Resource.IPTC_NAA: 1028 Resource.IMAGE_MODE_RAW: 1029 Resource.JPEG_QUALITY: 1030 Resource.URL: 1035 Resource.COLOR_SAMPLERS_RESOURCE_OBSOLETE: 1038 Resource.ICC_PROFILE: 1039 Resource.SPOT_HALFTONE: 1043 Resource.JUMP_TO_XPEP: 1052 Resource.EXIF_DATA_1: 1058 Resource.EXIF_DATA_3: 1059 Resource.XMP_METADATA: 1060 Resource.CAPTION_DIGEST: 1061 Resource.ALTERNATE_DUOTONE_COLORS: 1066 Resource.ALTERNATE_SPOT_COLORS: 1067 Resource.HDR_TONING_INFO: 1070 Resource.PRINT_INFO_CS2: 1071 Resource.COLOR_SAMPLERS_RESOURCE: 1073 Resource.DISPLAY_INFO: 1077 Resource.MAC_NSPRINTINFO: 1084 Resource.WINDOWS_DEVMODE: 1085 Resource.PATH_INFO_N: 2000-2999 Resource.PLUGIN_RESOURCES_N: 4000-4999 Resource.IMAGE_READY_VARIABLES: 7000 Resource.IMAGE_READY_DATA_SETS: 7001 Resource.IMAGE_READY_DEFAULT_SELECTED_STATE: 7002 Resource.IMAGE_READY_7_ROLLOVER_EXPANDED_STATE: 7003 Resource.IMAGE_READY_ROLLOVER_EXPANDED_STATE: 7004 Resource.IMAGE_READY_SAVE_LAYER_SETTINGS: 7005 Resource.IMAGE_READY_VERSION: 7006 Resource.LIGHTROOM_WORKFLOW: 8000
ImageResources¶
- class psd_tools.psd.image_resources.ImageResources(items=NOTHING)
- Image resources section of the PSD file. Dict of ImageResource.
- get_data(key, default=None)
- Get data from the image resources.
Shortcut for the following:
if key in image_resources:
value = tagged_blocks[key].data
ImageResource¶
- class psd_tools.psd.image_resources.ImageResource(signature: bytes = b'8BIM', key: int = 1000, name: str = '', data: bytes = b'')
- Image resource block.
- signature
- Binary signature, always b'8BIM'.
- key
- Unique identifier for the resource. See Resource.
- data
- The resource data.
AlphaIdentifiers¶
- class psd_tools.psd.image_resources.AlphaIdentifiers(items=NOTHING)
- List of alpha identifiers.
AlphaNamesPascal¶
- class psd_tools.psd.image_resources.AlphaNamesPascal(items=NOTHING)
- List of alpha names.
AlphaNamesUnicode¶
- class psd_tools.psd.image_resources.AlphaNamesUnicode(items=NOTHING)
- List of alpha names.
Byte¶
- class psd_tools.psd.image_resources.Byte(value=0)
- Byte element.
GridGuidesInfo¶
- class psd_tools.psd.image_resources.GridGuidesInfo(version: int = 1, horizontal: int = 0, vertical: int = 0, data=NOTHING)
- Grid and guides info structure.
HalftoneScreens¶
- class psd_tools.psd.image_resources.HalftoneScreens(items=NOTHING)
- Halftone screens.
HalftoneScreen¶
Integer¶
- class psd_tools.psd.image_resources.Integer(value=0)
- Integer element.
LayerGroupEnabledIDs¶
- class psd_tools.psd.image_resources.LayerGroupEnabledIDs(items=NOTHING)
- Layer group enabled ids.
LayerGroupInfo¶
- class psd_tools.psd.image_resources.LayerGroupInfo(items=NOTHING)
- Layer group info list.
LayerSelectionIDs¶
- class psd_tools.psd.image_resources.LayerSelectionIDs(items=NOTHING)
- Layer selection ids.
ShortInteger¶
- class psd_tools.psd.image_resources.ShortInteger(value=0)
- Short integer element.
PascalString¶
- class psd_tools.psd.image_resources.PascalString(value=None)
- Pascal string element.
PixelAspectRatio¶
PrintFlags¶
PrintFlagsInfo¶
- class psd_tools.psd.image_resources.PrintFlagsInfo(version: int = 0, center_crop: int = 0, bleed_width_value: int = 0, bleed_width_scale: int = 0)
- Print flags info structure.
PrintScale¶
- class psd_tools.psd.image_resources.PrintScale(style=PrintScaleStyle.CENTERED, x: float = 0.0, y: float = 0.0, scale: float = 0.0)
- Print scale structure.
ResoulutionInfo¶
- class psd_tools.psd.image_resources.ResoulutionInfo(horizontal: int = 0, horizontal_unit: int = 0, width_unit: int = 0, vertical: int = 0, vertical_unit: int = 0, height_unit: int = 0)
- Resoulution info structure.
Slices¶
SlicesV6¶
- class psd_tools.psd.image_resources.SlicesV6(bbox=NOTHING, name: str = '', items=NOTHING)
- Slices resource version 6.
SliceV6¶
ThumbnailResource¶
- class psd_tools.psd.image_resources.ThumbnailResource(fmt: int = 0, width: int = 0, height: int = 0, row: int = 0, total_size: int = 0, bits: int = 0, planes: int = 0, data: bytes = b'')
- Thumbnail resource structure.
ThumbnailResourceV4¶
TransferFunctions¶
- class psd_tools.psd.image_resources.TransferFunctions(items=NOTHING)
- Transfer functions.
TransferFunction¶
URLList¶
- class psd_tools.psd.image_resources.URLList(items=NOTHING)
- URL list structure.
URLItem¶
VersionInfo¶
- class psd_tools.psd.image_resources.VersionInfo(version: int = 1, has_composite: bool = False, writer: str = '', reader: str = '', file_version: int = 1)
- Version info structure.
psd_tools.psd.layer_and_mask¶
Layer and mask data structure.
LayerAndMaskInformation¶
- class psd_tools.psd.layer_and_mask.LayerAndMaskInformation(layer_info=None, global_layer_mask_info=None, tagged_blocks=None)
- Layer and mask information section.
- layer_info
- See LayerInfo.
- global_layer_mask_info
- See GlobalLayerMaskInfo.
- tagged_blocks
- See TaggedBlocks.
LayerInfo¶
- class psd_tools.psd.layer_and_mask.LayerInfo(layer_count: int = 0, layer_records=None, channel_image_data=None)
- High-level organization of the layer information.
- layer_count
- Layer count. If it is a negative number, its absolute value is the number of layers and the first alpha channel contains the transparency data for the merged result.
- layer_records
- Information about each layer. See LayerRecords.
- channel_image_data
- Channel image data. See ChannelImageData.
GlobalLayerMaskInfo¶
- class psd_tools.psd.layer_and_mask.GlobalLayerMaskInfo(overlay_color=None, opacity: int = 0, kind=GlobalLayerMaskKind.PER_LAYER)
- Global mask information.
- overlay_color
- Overlay color space (undocumented) and color components.
- opacity
- Opacity. 0 = transparent, 100 = opaque.
- kind
- Kind. 0 = Color selected--i.e. inverted; 1 = Color protected; 128 = use value stored per layer. This value is preferred. The others are for backward compatibility with beta versions.
LayerRecords¶
- class psd_tools.psd.layer_and_mask.LayerRecords(items=NOTHING)
- List of layer records. See LayerRecord.
LayerRecord¶
- top
- Top position.
- left
- Left position.
- bottom
- Bottom position.
- right
- Right position.
- channel_info
- List of ChannelInfo.
- signature
- Blend mode signature b'8BIM'.
- blend_mode
- Blend mode key. See BlendMode.
- opacity
- Opacity, 0 = transparent, 255 = opaque.
- clipping
- Clipping, 0 = base, 1 = non-base. See Clipping.
- flags
- See LayerFlags.
- mask_data
- MaskData or None.
- blending_ranges
- See LayerBlendingRanges.
- name
- Layer name.
- tagged_blocks
- See TaggedBlocks.
- property channel_sizes
- List of channel sizes: [(width, height)].
- property height
- Height of the layer.
- property width
- Width of the layer.
LayerFlags¶
- class psd_tools.psd.layer_and_mask.LayerFlags(transparency_protected: bool = False, visible: bool = True, obsolete: bool = False, photoshop_v5_later: bool = True, pixel_data_irrelevant: bool = False, undocumented_1: bool = False, undocumented_2: bool = False, undocumented_3: bool = False)
- Layer flags.
Note there are undocumented flags. Maybe photoshop version.
LayerBlendingRanges¶
- class psd_tools.psd.layer_and_mask.LayerBlendingRanges(composite_ranges=NOTHING, channel_ranges=NOTHING)
- Layer blending ranges.
All ranges contain 2 black values followed by 2 white values.
- composite_ranges
- List of composite gray blend source and destination ranges.
- channel_ranges
- List of channel source and destination ranges.
MaskData¶
- class psd_tools.psd.layer_and_mask.MaskData(top: int = 0, left: int = 0, bottom: int = 0, right: int = 0, background_color: int = 0, flags=NOTHING, parameters=None, real_flags=None, real_background_color=None, real_top=None, real_left=None, real_bottom=None, real_right=None)
- Mask data.
Real user mask is a final composite mask of vector and pixel masks.
- top
- Top position.
- left
- Left position.
- bottom
- Bottom position.
- right
- Right position.
- background_color
- Default color. 0 or 255.
- flags
- See MaskFlags.
- parameters
- MaskParameters or None.
- real_flags
- Real user mask flags. See MaskFlags.
- real_background_color
- Real user mask background. 0 or 255.
- real_top
- Top position of real user mask.
- real_left
- Left position of real user mask.
- real_bottom
- Bottom position of real user mask.
- real_right
- Right position of real user mask.
- property height
- Height of the mask.
- property real_height
- Height of real user mask.
- property real_width
- Width of real user mask.
- property width
- Width of the mask.
MaskFlags¶
- pos_relative_to_layer
- Position relative to layer.
- mask_disabled
- Layer mask disabled.
- invert_mask
- Invert layer mask when blending (Obsolete).
- user_mask_from_render
- The user mask actually came from rendering other data.
- parameters_applied
- The user and/or vector masks have parameters applied to them.
MaskParameters¶
- class psd_tools.psd.layer_and_mask.MaskParameters(user_mask_density=None, user_mask_feather=None, vector_mask_density=None, vector_mask_feather=None)
- Mask parameters.
ChannelInfo¶
- class psd_tools.psd.layer_and_mask.ChannelInfo(id=ChannelID.CHANNEL_0, length: int = 0)
- Channel information.
- id
- Channel ID: 0 = red, 1 = green, etc.; -1 = transparency mask; -2 = user supplied layer mask, -3 real user supplied layer mask (when both a user mask and a vector mask are present). See ChannelID.
- length
- Length of the corresponding channel data.
ChannelImageData¶
- class psd_tools.psd.layer_and_mask.ChannelImageData(items=NOTHING)
- List of channel data list.
This size of this list corresponds to the size of LayerRecords. Each item corresponds to the channels of each layer.
See ChannelDataList.
ChannelDataList¶
- class psd_tools.psd.layer_and_mask.ChannelDataList(items=NOTHING)
- List of channel image data, corresponding to each color or alpha.
See ChannelData.
ChannelData¶
- class psd_tools.psd.layer_and_mask.ChannelData(compression=Compression.RAW, data: bytes = b'')
- Channel data.
- compression
- Compression type. See Compression.
- data
- Data.
- get_data(width, height, depth, version=1)
- Get decompressed channel data.
- width -- width.
- height -- height.
- depth -- bit depth of the pixel.
- version -- psd file version.
- Return type
- bytes
- set_data(data, width, height, depth, version=1)
- Set raw channel data and compress to store.
- data -- raw data bytes to write.
- compression -- compression type, see Compression.
- width -- width.
- height -- height.
- depth -- bit depth of the pixel.
- version -- psd file version.
psd_tools.psd.linked_layer¶
Linked layer structure.
LinkedLayers¶
- class psd_tools.psd.linked_layer.LinkedLayers(items=NOTHING)
- List of LinkedLayer structure. See LinkedLayer.
LinkedLayer¶
psd_tools.psd.patterns¶
Patterns structure.
Patterns¶
- class psd_tools.psd.patterns.Patterns(items=NOTHING)
- List of Pattern structure. See Pattern.
Pattern¶
- class psd_tools.psd.patterns.Pattern(version: int = 1, image_mode=<enum 'ColorMode'>, point=None, name: str = '', pattern_id: str = '', color_table=None, data=None)
- Pattern structure.
- image_mode
- See ColorMode
- point
- Size in tuple.
- name
- str name of the pattern.
- pattern_id
- ID of this pattern.
- color_table
- Color table if the mode is INDEXED.
- data
- See VirtualMemoryArrayList
VirtualMemoryArrayList¶
- class psd_tools.psd.patterns.VirtualMemoryArrayList(version: int = 3, rectangle=None, channels=None)
- VirtualMemoryArrayList structure. Container of channels.
- rectangle
- Tuple of int
- channels
- List of VirtualMemoryArray
VirtualMemoryArray¶
- class psd_tools.psd.patterns.VirtualMemoryArray(is_written=0, depth=None, rectangle=None, pixel_depth=None, compression=Compression.RAW, data=b'')
- VirtualMemoryArrayList structure, corresponding to each channel.
- get_data()
- Get decompressed bytes.
- set_data(size, data, depth, compression=0)
- Set bytes.
psd_tools.psd.tagged_blocks¶
Tagged block data structure.
Todo¶
Support the following tagged blocks: Tag.PATTERN_DATA,
Tag.TYPE_TOOL_INFO, Tag.LAYER, Tag.ALPHA
TaggedBlocks¶
- class psd_tools.psd.tagged_blocks.TaggedBlocks(items=NOTHING)
- Dict of tagged block items.
See Tag for available keys.
Example:
from psd_tools.constants import Tag # Iterate over fields for key in tagged_blocks:
print(key) # Get a field value = tagged_blocks.get_data(Tag.TYPE_TOOL_OBJECT_SETTING)
TaggedBlock¶
- class psd_tools.psd.tagged_blocks.TaggedBlock(signature=b'8BIM', key=b'', data=b'')
- Layer tagged block with extra info.
- key
- 4-character code. See Tag
- data
- Data.
Annotations¶
- class psd_tools.psd.tagged_blocks.Annotations(items=NOTHING, major_version: int = 2, minor_version: int = 1)
- List of Annotation, see :py:class: .Annotation.
Annotation¶
Bytes¶
ChannelBlendingRestrictionsSetting¶
- class psd_tools.psd.tagged_blocks.ChannelBlendingRestrictionsSetting(items=NOTHING)
- ChannelBlendingRestrictionsSetting structure.
List of restricted channel numbers (int).
FilterMask¶
MetadataSettings¶
- class psd_tools.psd.tagged_blocks.MetadataSettings(items=NOTHING)
- MetadataSettings structure.
MetadataSetting¶
PixelSourceData2¶
- class psd_tools.psd.tagged_blocks.PixelSourceData2(items=NOTHING)
- PixelSourceData2 structure.
PlacedLayerData¶
ProtectedSetting¶
- class psd_tools.psd.tagged_blocks.ProtectedSetting(value=0)
- ProtectedSetting structure.
ReferencePoint¶
- class psd_tools.psd.tagged_blocks.ReferencePoint(items=NOTHING)
- ReferencePoint structure.
SectionDividerSetting¶
- class psd_tools.psd.tagged_blocks.SectionDividerSetting(kind=SectionDivider.OTHER, signature=None, blend_mode=None, sub_type=None)
- SectionDividerSetting structure.
SheetColorSetting¶
- class psd_tools.psd.tagged_blocks.SheetColorSetting(value=0)
- SheetColorSetting value.
This setting represents color label in the layers panel in Photoshop UI.
SmartObjectLayerData¶
- class psd_tools.psd.tagged_blocks.SmartObjectLayerData(kind: bytes = b'soLD', version: int = 5, data: DescriptorBlock = None)
- VersionedDescriptorBlock structure.
TypeToolObjectSetting¶
- class psd_tools.psd.tagged_blocks.TypeToolObjectSetting(version: int = 1, transform: tuple = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), text_version: int = 1, text_data: DescriptorBlock = None, warp_version: int = 1, warp: DescriptorBlock = None, left: int = 0, top: int = 0, right: int = 0, bottom: int = 0)
- TypeToolObjectSetting structure.
- transform
- Tuple of affine transform parameters (xx, xy, yx, yy, tx, ty).
UserMask¶
- class psd_tools.psd.tagged_blocks.UserMask(color=None, opacity: int = 0, flag: int = 128)
- UserMask structure.
psd_tools.psd.vector¶
Vector mask, path, and stroke structure.
Path¶
- class psd_tools.psd.vector.Path(items=NOTHING)
- List-like Path structure. Elements are either PathFillRule, InitialFillRule, ClipboardRecord, ClosedPath, or OpenPath.
Subpath¶
- class psd_tools.psd.vector.Subpath(items=NOTHING, operation: int = 1, unknown1: int = 1, unknown2: int = 0, index: int = 0, unknown3: bytes = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
- Subpath element. This is a list of Knot objects.
NOTE:
- operation
- int value indicating how multiple subpath should be combined:
1: Or (union), 2: Not-Or, 3: And (intersect), 0: Xor (exclude)
The first path element is applied to the background surface. Intersection does not have strokes.
- index
- int index that specifies corresponding origination object.
Knot¶
- class psd_tools.psd.vector.Knot(preceding: tuple = (0.0, 0.0), anchor: tuple = (0.0, 0.0), leaving: tuple = (0.0, 0.0))
- Knot element consisting of 3 control points for Bezier curves.
- preceding
- (y, x) tuple of preceding control point in relative coordinates.
- anchor
- (y, x) tuple of anchor point in relative coordinates.
- leaving
- (y, x) tuple of leaving control point in relative coordinates.
ClipboardRecord¶
- class psd_tools.psd.vector.ClipboardRecord(top: int = 0, left: int = 0, bottom: int = 0, right: int = 0, resolution: int = 0)
- Clipboard record.
- top
- Top position in int
- left
- Left position in int
- bottom
- Bottom position in int
- right
- Right position in int
- resolution
- Resolution in int
PathFillRule¶
- class psd_tools.psd.vector.PathFillRule
- Path fill rule record, empty.
InitialFillRule¶
- class psd_tools.psd.vector.InitialFillRule(value=0)
- Initial fill rule record.
- rule
- A value of 1 means that the fill starts with all pixels. The value will be either 0 or 1.
VectorMaskSetting¶
- class psd_tools.psd.vector.VectorMaskSetting(version: int = 3, flags: int = 0, path=None)
- VectorMaskSetting structure.
- path
- List of Subpath objects.
- property disable
- Flag to indicate that the vector mask is disabled.
- property invert
- Flag to indicate that the vector mask is inverted.
- property not_link
- Flag to indicate that the vector mask is not linked.
VectorStrokeContentSetting¶
- class psd_tools.psd.vector.VectorStrokeContentSetting(items=NOTHING, name: str = '', classID=b'null', key: bytes = b'\x00\x00\x00\x00', version: int = 1)
- Dict-like Descriptor-based structure. See Descriptor.
psd_tools.terminology¶
Constants for descriptor.
This file is automaticaly generated by tools/extract_terminology.py
Klass¶
- class psd_tools.terminology.Klass(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Klass definitions extracted from PITerminology.h.
- BevelEmboss = b'ebbl'
- BrightnessContrast = b'BrgC'
- ChannelMixer = b'ChnM'
- ColorBalance = b'ClrB'
- Curves = b'Crvs'
- DropShadow = b'DrSh'
- Ellipse = b'Elps'
- GradientFill = b'Grdf'
- GradientMap = b'GdMp'
- HalftoneScreen = b'HlfS'
- HueSaturation = b'HStr'
- InnerGlow = b'IrGl'
- InnerShadow = b'IrSh'
- Levels = b'Lvls'
- Line = b'Ln '
- Mask = b'Msk '
- Offset = b'Ofst'
- OuterGlow = b'OrGl'
- Path = b'Path'
- Pattern = b'PttR'
- Posterize = b'Pstr'
- Property = b'Prpr'
- Rectangle = b'Rctn'
- SelectiveColor = b'SlcC'
- Threshold = b'Thrs'
Enum¶
- class psd_tools.terminology.Enum(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Enum definitions extracted from PITerminology.h.
- BlackAndWhite = b'BanW'
- Ellipse = b'Elps'
- GradientFill = b'GrFl'
- HalftoneScreen = b'HlfS'
- Line = b'Ln '
- Mask = b'Msk '
- Pattern = b'Ptrn'
- Threshold = b'Thrh'
- _16BitsPerPixel = b'16Bt'
- _1BitPerPixel = b'OnBt'
- _2BitsPerPixel = b'2Bts'
- _32BitsPerPixel = b'32Bt'
- _4BitsPerPixel = b'4Bts'
- _5000 = b'5000'
- _5500 = b'5500'
- _6500 = b'6500'
- _72Color = b'72Cl'
- _72Gray = b'72Gr'
- _7500 = b'7500'
- _8BitsPerPixel = b'EghB'
- _9300 = b'9300'
- _None = b'None'
Event¶
- class psd_tools.terminology.Event(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Event definitions extracted from PITerminology.h.
- ChannelMixer = b'ChnM'
- ColorBalance = b'ClrB'
- Curves = b'Crvs'
- GradientMap = b'GrMp'
- Group = b'GrpL'
- HalftoneScreen = b'HlfS'
- HueSaturation = b'HStr'
- Levels = b'Lvls'
- Offset = b'Ofst'
- Posterize = b'Pstr'
- SelectiveColor = b'SlcC'
- Stroke = b'Strk'
- Threshold = b'Thrs'
- _3DTransform = b'TdT '
Form¶
- class psd_tools.terminology.Form(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Form definitions extracted from PITerminology.h.
- Class = b'Clss'
- Enumerated = b'Enmr'
- Identifier = b'Idnt'
- Index = b'indx'
- Offset = b'rele'
- Property = b'prop'
Key¶
- class psd_tools.terminology.Key(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Key definitions extracted from PITerminology.h.
- BevelEmboss = b'ebbl'
- Compression = b'Cmpr'
- DropShadow = b'DrSh'
- Exposure = b'Exps'
- GradientFill = b'Grdf'
- Group = b'Grup'
- HalftoneScreen = b'HlfS'
- InnerGlow = b'IrGl'
- InnerShadow = b'IrSh'
- Layers = b'Lyrs'
- Levels = b'Lvls'
- Line = b'Line'
- Name = b'Nm '
- Offset = b'Ofst'
- OuterGlow = b'OrGl'
- Path = b'Path'
- Pattern = b'Pttn'
- Threshold = b'Thsh'
- TransferFunction = b'TrnF'
- Type = b'Type'
- _3DAntiAlias = b'Alis'
Type¶
- class psd_tools.terminology.Type(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Type definitions extracted from PITerminology.h.
- BlendMode = b'BlnM'
- GlobalObject = b'GlbO'
- RawData = b'tdta'
- UnitFloat = b'UntF'
Unit¶
- class psd_tools.terminology.Unit(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- Unit definitions extracted from PITerminology.h.
- _None = b'#Nne'
INDICES AND TABLES¶
- Index
- Module Index
- Search Page
AUTHOR¶
Kota Yamaguchi
COPYRIGHT¶
2024, Kota Yamaguchi
August 26, 2024 | 1.9.34 |