| SRC(1) | psd-tools | SRC(1) |
src - src Documentation
psd-tools is a Python package for working with Adobe Photoshop PSD files as described in specification.
Use pip to install the package:
pip install psd-tools
NOTE:
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.
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
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')
If the PSD File's layer structure was updated, saving it will update the ImagaData section to produce an accurate thumbnail.
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'
It is possible to create a new PixelLayer from a PIL object, the PIL image will be converted to the color mode of the PSD File given in parameter:
PixelLayer.frompil(pil_image, psd_file, "Layer name", top_offset, left_offset, Compression.RLE)
See the function documentation for further parameter explanations.
Group has internal layers:
for layer in group:
print(layer) first_layer = group[0]
Create a new group object.:
Group.new("Group name", open_folder=True, parent=parent_group)
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.
The layer structure of a PSD object can be modified through methods emulating a python list.
The internal model of the psd layer structure will be automatically updated when saving the psd to a file or a similar operation. Moving a layer from a PSD to another will also automatically convert the PixelLayer to the target psd's color mode.
The follwing are valid for both PSDImage and Group objects.
Set an item:
group[0] = layer
Add a layer to a group:
group.append(layer)
Add a list of layers to a group:
group.extend(layers)
Insert a layer to a specific index in the group:
group.insert(3, layer)
Remove a layer from the a group:
group.remove(layer)
Pop a layer from the group:
layer = group.pop()
Emptying a layer group:
group.clear()
Get the index of a layer in the group:
group.index(layer)
Count the occurences of a layer in a group:
group.count(layer)
Move a given list of layers in a newly created Group. If no parent group is given in parameter, the new group will replace the first layer of the list in the PSD structure:
Group.group_layers(layer_list, "Group Name", parent=parent_group, open_folder=True)
Below an example of such an operation.:
- PSDImage
- Group 1
- PixelLayer
- FillLayer
- PixelLayer
- TypeLayer
- SmartObjectLayer
- PixelLayer Group.group_layers(PSDImage[:2], "New Group") - PSDImage
- New Group
- Group 1
- PixelLayer
- FillLayer
- PixelLayer
- TypeLayer
- SmartObjectLayer
- PixelLayer
Some operations are available for all Layer objects.
Delete a layer from its layer structure:
layer.delete()
Layers can be moved from a group to another:
layer.move_to_group(target_group)
Layers can be moved within the group to change their order:
layer.move_up(5) # Will send the layer upward in the group layer.move_down(3) # Will send the layer downward in the group
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.
PSDImage or layers can be exported to NumPy array by numpy() method:
image = psd.numpy() layer_image = layer.numpy()
psd-tools 1.10 has a few breaking changes.
Basic layer structure editing is supported in 1.10. You can add or remove a pixel layer, or change the grouping of layers.
psd-tools 1.10 drops compose module. Use composite instead.
version 1.10.x:
image = psd.composite() layer_image = layer.composite()
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()
There are major API changes in version 1.8.x.
NOTE:
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)
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.
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()
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
Pymaging support is dropped.
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.
The package consists of two major subpackages:
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
Install Sphinx to generate documents:
pip install sphinx sphinx_rtd_theme
Once installed, use Makefile:
make docs
Great thanks to all the contributors.
Supported:
Limited support:
Not supported:
See Usage for examples.
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()
Use viewbox to get viewport bounding box. When the psd is empty, bbox is equal to the canvas bounding box.
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)
See psd_tools.constants.Resource for available keys.
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)
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag patterns = psd.tagged_blocks.get_data(Tag.PATTERNS1)
Adjustment and fill layers.
Example:
if layer.kind == 'brightnesscontrast':
print(layer.brightness) if layer.kind == 'gradientfill':
print(layer.gradient_kind)
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()
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
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 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)
Levels contain a list of LevelRecord.
HueSaturation contains a list of data.
Effects module.
Layer module.
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
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)
If no parent is provided, the group will be put in place of the first layer in the given list. Example below:
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Example:
group = psd[1] for layer in group:
if layer.kind == 'pixel':
print(layer.name)
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
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)
If no parent is provided, the group will be put in place of the first layer in the given list. Example below:
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Example:
assert layer.kind == 'pixel':
image = layer.composite()
image.save('layer.png')
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
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))
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
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
Example:
from psd_tools.constants import BlendMode if layer.blend_mode == BlendMode.NORMAL:
layer.blend_mode = BlendMode.SCREEN
Example using the constants of ProtectedFlags and bitwise or operation to lock both pixels and positions:
layer.lock(ProtectedFlags.COMPOSITE | ProtectedFlags.POSITION)
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.
See psd_tools.constants.Tag for available keys.
Example:
from psd_tools.constants import Tag metadata = layer.tagged_blocks.get_data(Tag.METADATA_SETTING)
See psd_tools.constants.TextType.
Example:
from psd_tools.constants import ChannelID image = layer.topil() red = layer.topil(ChannelID.CHANNEL_0) alpha = layer.topil(ChannelID.TRANSPARENCY_MASK)
NOTE:
Mask module.
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.
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.
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.
Depending on the Photoshop version, this field can be None.
When 0, fill inside of the path. When 1, fill outside of the shape.
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]
This is a thin wrapper around Descriptor structure. Check _data attribute to get the raw data.
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.
This equals to a primitive shape that does not provide Live shape properties. Use VectorMask to access shape information instead of this origination object.
Smart object module.
Smart objects are attached to SmartObjectLayer.
Example:
with layer.smart_object.open() as f:
data = f.read()
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.
Various constants for psd_tools
Compression. 0 = Raw Data, 1 = RLE compressed, 2 = ZIP without prediction, 3 = ZIP with prediction.
Note the following is not defined for performance reasons.
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.
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)
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.
Pretty printing shows the internal value by default. Inherit with @attr.s(repr=False) decorator to keep this behavior.
Use with @attr.s(repr=False) decorator.
Use with @attr.s(repr=False) decorator.
Use with @attr.s(repr=False) decorator.
Use with @attr.s(repr=False) decorator.
Color mode data structure.
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.
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)
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])
Example:
for item in list_value:
print(item)
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)
>>
]
>> >>
TYPE_TOOL_OBJECT_SETTING tagged block contains this object in its descriptor.
TEXT_ENGINE_DATA tagged block has this object.
Effects layer structure.
Note the structures in this module is obsolete and object-based layer effects are stored in tagged blocks.
Filter effects structure.
File header structure.
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)
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.
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
Shortcut for the following:
if key in image_resources:
value = tagged_blocks[key].data
Layer and mask data structure.
Note there are undocumented flags. Maybe photoshop version.
All ranges contain 2 black values followed by 2 white values.
Real user mask is a final composite mask of vector and pixel masks.
This size of this list corresponds to the size of LayerRecords. Each item corresponds to the channels of each layer.
See ChannelDataList.
See ChannelData.
Linked layer structure.
Patterns structure.
Tagged block data structure.
Support the following tagged blocks: Tag.PATTERN_DATA,
Tag.TYPE_TOOL_INFO, Tag.LAYER, Tag.ALPHA
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)
List of restricted channel numbers (int).
This setting represents color label in the layers panel in Photoshop UI.
Vector mask, path, and stroke structure.
NOTE:
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.
Constants for descriptor.
This file is automaticaly generated by tools/extract_terminology.py
See https://www.adobe.com/devnet/photoshop/sdk.html
See https://www.adobe.com/devnet/photoshop/sdk.html
See https://www.adobe.com/devnet/photoshop/sdk.html
See https://www.adobe.com/devnet/photoshop/sdk.html
See https://www.adobe.com/devnet/photoshop/sdk.html
See https://www.adobe.com/devnet/photoshop/sdk.html
See https://www.adobe.com/devnet/photoshop/sdk.html
Kota Yamaguchi
2019, Kota Yamaguchi
| April 14, 2025 | 1.10.7 |