psdtags¶
Read and write layered TIFF ImageSourceData and ImageResources tags.
Psdtags is a Python library to read and write the Adobe Photoshop(r) specific ImageResources (#34377) and ImageSourceData (#37724) TIFF tags, which contain image resource blocks, layer and mask information found in a typical layered TIFF file created by Photoshop.
The format is specified in the Adobe Photoshop TIFF Technical Notes (March 22, 2002) and Adobe Photoshop File Formats Specification (November 2019).
Adobe Photoshop is a registered trademark of Adobe Systems Inc.
- Author:
- License:
BSD-3-Clause
- Version:
2026.1.29
- DOI:
Quickstart¶
Install the psdtags package and all dependencies from the Python Package Index:
python -m pip install -U psdtags[all]
View the layer image and metadata stored in a layered TIFF file:
python -m psdtags file.tif
See Examples for using the programming interface.
Source code, examples, and support are available on GitHub.
Requirements¶
This revision was tested with the following requirements and dependencies (other versions may work):
CPython 3.11.9, 3.12.10, 3.13.11, 3.14.2 64-bit
NumPy 2.4.1
Imagecodecs 2026.1.14 (required for compressing/decompressing image data)
Tifffile 2026.1.28 (required for reading/writing tags from/to TIFF files)
Matplotlib 3.10.8 (required for plotting)
Revisions¶
2026.1.29
Fix code review issues.
2026.1.8
Improve code quality.
2025.12.12
Make boolean and optional parameters keyword-only (breaking).
2025.9.19
Write MTrn key before layers (#17).
2025.9.15
Add CAI, GENI, and OCIO keys.
Drop support for Python 3.10.
2025.5.10
Support Python 3.14.
2025.1.1
…
Refer to the CHANGES file for older revisions.
Notes¶
The API is not stable yet and might change between revisions.
This library has been tested with a limited number of files only.
Additional layer information is not yet supported.
Consider psd-tools and pytoshop for working with Adobe Photoshop PSD files.
Layered TIFF files can be read or written by Photoshop, Affinity Photo, and Krita.
See also Reading and writing a Photoshop TIFF.
Examples¶
Read the ImageSourceData tag value from a layered TIFF file and iterate over all the channels:
>>> isd = TiffImageSourceData.fromtiff('layered.tif')
>>> for layer in isd.layers:
... layer.name
... for channel in layer.channels:
... ch = channel.data # a numpy array
...
'Background'
'Reflect1'
'Reflect2'
'image'
'Layer 1'
'ORight'
'I'
'IShadow'
'O'
Read the ImageResources tag value from the TIFF file, iterate over the blocks, and get the thumbnail image:
>>> res = TiffImageResources.fromtiff('layered.tif')
>>> for block in res.blocks:
... blockname = block.name
...
>>> res.thumbnail().shape
(90, 160, 3)
Write the image, ImageSourceData and ImageResources to a new layered TIFF file:
>>> from tifffile import imread, imwrite
>>> image = imread('layered.tif')
>>> imwrite(
... '_layered.tif',
... image,
... byteorder=isd.byteorder, # must match ImageSourceData
... photometric='rgb', # must match ImageSourceData
... metadata=None, # do not write any tifffile specific metadata
... extratags=[isd.tifftag(maxworkers=4), res.tifftag()],
... )
Verify that the new layered TIFF file contains readable ImageSourceData:
>>> assert isd == TiffImageSourceData.fromtiff('_layered.tif')
>>> assert res == TiffImageResources.fromtiff('_layered.tif')
View the layer and mask information as well as the image resource blocks in a layered TIFF file from a command line:
python -m psdtags layered.tif
Refer to the layered_tiff.py example in the source distribution for creating a layered TIFF file from individual layer images.
License¶
Copyright (c) 2022-2026, Christoph Gohlke
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
psdtags module¶
- psdtags.__version__ = '2026.1.29'¶
Psdtags version string.
- class psdtags.PsdBoolean(key, value)¶
Bases:
PsdKeyABCBoolean.
- Parameters:
key (PsdKey)
value (bool)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write boolean to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- class psdtags.PsdBytesBlock(resourceid, value, name='')¶
Bases:
PsdResourceBlockABCImage resource blocks stored as opaque bytes.
- Parameters:
resourceid (PsdResourceId)
value (bytes)
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write instance values to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, value, name='')¶
- Parameters:
resourceid (PsdResourceId)
value (bytes)
name (str)
- Return type:
None
- class psdtags.PsdChannel(channelid, compression=PsdCompressionType.RAW, data=None, _data_length=0)¶
Bases:
objectChannelInfo and ChannelImageData.
- Parameters:
channelid (PsdChannelId)
compression (PsdCompressionType)
data (NDArray[Any] | None)
_data_length (int)
- classmethod read(fh, psdformat, /)¶
Return instance from open file.
Channel image data must be read separately using
PsdChannel.read_image().- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
- classmethod frombytes(data, psdformat, /)¶
Return instance from bytes.
- Parameters:
data (bytes)
psdformat (PsdFormat)
- Return type:
- read_image(fh, psdformat, /, shape, dtype)¶
Read channel image data from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
shape (tuple[int, ...])
dtype (DTypeLike)
- Return type:
None
- tobytes(psdformat, /, compression=None)¶
Return channel info and image data records.
- Parameters:
psdformat (PsdFormat)
compression (PsdCompressionType | None)
- Return type:
tuple[bytes, bytes]
- write(fh, psdformat, /, compression=None)¶
Write channel info record to file and return image data record.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
compression (PsdCompressionType | None)
- Return type:
bytes
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- __init__(channelid, compression=PsdCompressionType.RAW, data=None, _data_length=0)¶
- Parameters:
channelid (PsdChannelId)
compression (PsdCompressionType)
data (NDArray[Any] | None)
_data_length (int)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdChannelId(*values)¶
Bases:
IntEnumChannel types.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdClippingType(*values)¶
Bases:
IntEnumClipping types.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdColorBlock(resourceid, colorspace, components=(0, 0, 0, 0), name='')¶
Bases:
PsdResourceBlockABCColor structure.
- Parameters:
resourceid (PsdResourceId)
colorspace (PsdColorSpaceType)
components (tuple[int, int, int, int])
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write instance values to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, colorspace, components=(0, 0, 0, 0), name='')¶
- Parameters:
resourceid (PsdResourceId)
colorspace (PsdColorSpaceType)
components (tuple[int, int, int, int])
name (str)
- Return type:
None
- class psdtags.PsdColorSpaceType(*values)¶
Bases:
IntEnumColor space types.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdColorType(*values)¶
Bases:
IntEnumColor IDs used by sheet color setting structure.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdCompressionType(*values)¶
Bases:
IntEnumImage compression types.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdEmpty(key)¶
Bases:
PsdKeyABCEmpty structure, no data associated with key.
- Parameters:
key (PsdKey)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- classmethod frombytes(data, psdformat, key, /)¶
Return instance from bytes.
- tobytes(psdformat, /)¶
Return empty byte string.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- write(fh, psdformat, /)¶
Write nothing to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- class psdtags.PsdExposure(exposure, offset, gamma)¶
Bases:
PsdKeyABCExposure.
- Parameters:
exposure (float)
offset (float)
gamma (float)
- classmethod read(fh, psdformat, key, /, length)¶
Return exposure from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write exposure to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(exposure, offset, gamma)¶
- Parameters:
exposure (float)
offset (float)
gamma (float)
- Return type:
None
- class psdtags.PsdFilterMask(colorspace, components=(0, 0, 0, 0), opacity=0)¶
Bases:
PsdKeyABCFilter Mask (Photoshop CS3).
- Parameters:
colorspace (PsdColorSpaceType)
components (tuple[int, int, int, int])
opacity (int)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- tobytes(psdformat, /)¶
Return filter mask record.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- write(fh, psdformat, /)¶
Write filter mask record to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(colorspace, components=(0, 0, 0, 0), opacity=0)¶
- Parameters:
colorspace (PsdColorSpaceType)
components (tuple[int, int, int, int])
opacity (int)
- Return type:
None
- class psdtags.PsdFormat(*values)¶
Bases:
bytes,EnumPSD format.
- property byteorder: Literal['>', '<']¶
Byte-order of PSD format.
- property sizeformat: str¶
Struct format string for size values.
- property utf16: str¶
UTF-16 encoding.
- property isb64: bool¶
PSD format is 64-bit.
- read(fh, fmt)¶
Return unpacked values.
- Parameters:
fh (BinaryIO)
fmt (str)
- Return type:
Any
- write(fh, fmt, *values)¶
Write values to open file.
- Parameters:
fh (BinaryIO)
fmt (str)
values (Any)
- Return type:
int
- pack(fmt, *values)¶
Return packed values.
- Parameters:
fmt (str)
values (Any)
- Return type:
bytes
- read_size(fh, key=None)¶
Return integer whose size depends on signature or key from file.
- Parameters:
fh (BinaryIO)
key (PsdKey | None)
- Return type:
int
- write_size(fh, value, key=None)¶
Write integer whose size depends on signature or key to file.
- Parameters:
fh (BinaryIO)
value (int)
key (PsdKey | None)
- Return type:
int
- pack_size(value, key=None)¶
Pack integer whose size depends on signature or key.
- Parameters:
value (int)
key (PsdKey | None)
- Return type:
bytes
- write_signature(fh, signature, /)¶
Write signature to file.
- Parameters:
fh (BinaryIO)
signature (bytes)
- Return type:
int
- write_key(fh, key, /)¶
Write signature to file.
- Parameters:
fh (BinaryIO)
key (PsdKey)
- Return type:
int
- __new__(value)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class psdtags.PsdImageMode(*values)¶
Bases:
IntEnumImage modes.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdInteger(key, value)¶
Bases:
PsdKeyABC4 Byte Integer.
- Parameters:
key (PsdKey)
value (int)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write integer to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- class psdtags.PsdKeyABC¶
Bases:
objectAbstract base class for structures with key.
- abstractmethod classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- classmethod frombytes(data, psdformat, key, /)¶
Return instance from bytes.
- abstractmethod write(fh, psdformat, /)¶
Write instance values to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- tobytes(psdformat, /)¶
Return instance values as bytes.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- __repr__()¶
Return repr(self).
- Return type:
str
- __weakref__¶
list of weak references to the object
- class psdtags.PsdLayer(name, channels, rectangle, mask=None, opacity=255, blendmode=PsdBlendMode.NORMAL, blending_ranges=(), clipping=PsdClippingType.BASE, flags=<PsdLayerFlag.BASE: 0>, info=<factory>)¶
Bases:
objectPSD layer record.
- Parameters:
name (str)
channels (list[PsdChannel])
rectangle (PsdRectangle)
mask (PsdLayerMask | None)
opacity (int)
blendmode (PsdBlendMode)
blending_ranges (tuple[int, ...])
clipping (PsdClippingType)
flags (PsdLayerFlag)
info (list[Any])
- classmethod read(fh, psdformat, /, *, unknown=True)¶
Return instance from open file.
Channel image data must be read separately.
- classmethod frombytes(data, psdformat, /)¶
Return instance from bytes.
- write(fh, psdformat, /, *, compression=None, unknown=True, maxworkers=1)¶
Write layer record to open file and return channel data records.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
bytes
- tobytes(psdformat, /, *, compression=None, unknown=True, maxworkers=1)¶
Return layer and channel data records.
- Parameters:
psdformat (PsdFormat)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
tuple[bytes, bytes]
- asarray(*, channelid=None, planar=False)¶
Return channel image data.
- Parameters:
channelid (PsdChannelId | None)
planar (bool)
- Return type:
NDArray[Any]
- property shape: tuple[int, int]¶
Height and width of layer image.
- property offset: tuple[int, int]¶
Top-left position of layer image.
- property title: str¶
Name of layer.
- property has_unknowns: bool¶
Layer has unknown structures in info.
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- __init__(name, channels, rectangle, mask=None, opacity=255, blendmode=PsdBlendMode.NORMAL, blending_ranges=(), clipping=PsdClippingType.BASE, flags=<PsdLayerFlag.BASE: 0>, info=<factory>)¶
- Parameters:
name (str)
channels (list[PsdChannel])
rectangle (PsdRectangle)
mask (PsdLayerMask | None)
opacity (int)
blendmode (PsdBlendMode)
blending_ranges (tuple[int, ...])
clipping (PsdClippingType)
flags (PsdLayerFlag)
info (list[Any])
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdLayerFlag(*values)¶
Bases:
IntFlagLayer record flags.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __or__(other)¶
Return self|value.
- __and__(other)¶
Return self&value.
- __xor__(other)¶
Return self^value.
- __ror__(other)¶
Return value|self.
- __rand__(other)¶
Return value&self.
- __rxor__(other)¶
Return value^self.
- __invert__()¶
~self
- __new__(value)¶
- class psdtags.PsdLayerMask(default_color=0, rectangle=None, flags=<PsdLayerMaskFlag.BASE: 0>, user_mask_density=None, user_mask_feather=None, vector_mask_density=None, vector_mask_feather=None, real_flags=None, real_background=None, real_rectangle=None)¶
Bases:
objectLayer mask / adjustment layer data.
- Parameters:
default_color (int)
rectangle (PsdRectangle | None)
flags (PsdLayerMaskFlag)
user_mask_density (int | None)
user_mask_feather (float | None)
vector_mask_density (int | None)
vector_mask_feather (float | None)
real_flags (PsdLayerMaskFlag | None)
real_background (int | None)
real_rectangle (PsdRectangle | None)
- classmethod read(fh, psdformat, /)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
- classmethod frombytes(data, psdformat, /)¶
Return instance from bytes.
- Parameters:
data (bytes)
psdformat (PsdFormat)
- Return type:
- tobytes(psdformat, /)¶
Return layer mask structure.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- write(fh, psdformat, /)¶
Write layer mask structure to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- property param_flags: PsdLayerMaskParameterFlag¶
Layer mask parameter flags.
- property shape: tuple[int, int]¶
Height and width of layer mask.
- property offset: tuple[int, int]¶
Top-left position of layer mask.
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(default_color=0, rectangle=None, flags=<PsdLayerMaskFlag.BASE: 0>, user_mask_density=None, user_mask_feather=None, vector_mask_density=None, vector_mask_feather=None, real_flags=None, real_background=None, real_rectangle=None)¶
- Parameters:
default_color (int)
rectangle (PsdRectangle | None)
flags (PsdLayerMaskFlag)
user_mask_density (int | None)
user_mask_feather (float | None)
vector_mask_density (int | None)
vector_mask_feather (float | None)
real_flags (PsdLayerMaskFlag | None)
real_background (int | None)
real_rectangle (PsdRectangle | None)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdLayerMaskFlag(*values)¶
Bases:
IntFlagLayer mask flags.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __or__(other)¶
Return self|value.
- __and__(other)¶
Return self&value.
- __xor__(other)¶
Return self^value.
- __ror__(other)¶
Return value|self.
- __rand__(other)¶
Return value&self.
- __rxor__(other)¶
Return value^self.
- __invert__()¶
~self
- __new__(value)¶
- class psdtags.PsdLayerMaskParameterFlag(*values)¶
Bases:
IntFlagLayer mask parameters.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __or__(other)¶
Return self|value.
- __and__(other)¶
Return self&value.
- __xor__(other)¶
Return self^value.
- __ror__(other)¶
Return value|self.
- __rand__(other)¶
Return value&self.
- __rxor__(other)¶
Return value^self.
- __invert__()¶
~self
- __new__(value)¶
- class psdtags.PsdLayers(key, layers=<factory>, has_transparency=False)¶
Bases:
PsdKeyABCSequence of PsdLayer.
- classmethod read(fh, psdformat, key, /, length, *, unknown=True)¶
Return instance from open file.
- classmethod frombytes(data, psdformat, key, /, *, unknown=True)¶
Return instance from bytes.
- write(fh, psdformat, /, *, compression=None, unknown=True, maxworkers=1)¶
Write layer records and channel info data to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
int
- tobytes(psdformat, /, *, compression=None, unknown=True, maxworkers=1)¶
Return layer records and channel info data as bytes.
- Parameters:
psdformat (PsdFormat)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
bytes
- property dtype: numpy.dtype[Any]¶
Data type of layer images.
- property shape: tuple[int, int]¶
Height and width of layer images.
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- class psdtags.PsdMetadataSetting(signature, key, data=b'', copyonsheet=False)¶
Bases:
objectMetadata setting item.
- Parameters:
signature (PsdFormat)
key (bytes)
data (bytes)
copyonsheet (bool)
- classmethod read(fh, psdformat)¶
Return metadata setting from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
- write(fh, psdformat, /)¶
Write metadata setting to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- __init__(signature, key, data=b'', copyonsheet=False)¶
- Parameters:
signature (PsdFormat)
key (bytes)
data (bytes)
copyonsheet (bool)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdMetadataSettings(items=<factory>)¶
Bases:
PsdKeyABCMetadata setting (Photoshop 6.0).
- Parameters:
items (list[PsdMetadataSetting])
- classmethod read(fh, psdformat, key, /, length)¶
Return metadata settings from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write metadata settings to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(items=<factory>)¶
- Parameters:
items (list[PsdMetadataSetting])
- Return type:
None
- class psdtags.PsdPascalString(value)¶
Bases:
objectPascal string.
- Parameters:
value (str)
- classmethod read(fh, pad=1)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
pad (int)
- Return type:
- write(fh, pad=1)¶
Write Pascal string to open file.
- Parameters:
fh (BinaryIO)
pad (int)
- Return type:
int
- __str__()¶
Return str(self).
- Return type:
str
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(value)¶
- Parameters:
value (str)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdPascalStringBlock(resourceid, value, name='')¶
Bases:
PsdResourceBlockABCPascal string.
- Parameters:
resourceid (PsdResourceId)
value (str)
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write Pascal string to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, value, name='')¶
- Parameters:
resourceid (PsdResourceId)
value (str)
name (str)
- Return type:
None
- class psdtags.PsdPascalStringsBlock(resourceid, values, name='')¶
Bases:
PsdResourceBlockABCSeries of Pascal strings.
- Parameters:
resourceid (PsdResourceId)
values (list[str])
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write sequence of Pascal strings to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, values, name='')¶
- Parameters:
resourceid (PsdResourceId)
values (list[str])
name (str)
- Return type:
None
- class psdtags.PsdPatterns(key, imagemode, name, guid, data, colortable=None, point=<factory>)¶
Bases:
PsdKeyABCPatterns (Photoshop 6.0 and CS 8.0).
- Parameters:
key (PsdKey)
imagemode (PsdImageMode)
name (str)
guid (str)
data (PsdVirtualMemoryArrayList)
colortable (NDArray[numpy.uint8] | None)
point (PsdPoint)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write patterns to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- asarray(*, planar=False)¶
Return channel image data.
- Parameters:
planar (bool)
- Return type:
NDArray[Any]
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(key, imagemode, name, guid, data, colortable=None, point=<factory>)¶
- Parameters:
key (PsdKey)
imagemode (PsdImageMode)
name (str)
guid (str)
data (PsdVirtualMemoryArrayList)
colortable (NDArray[numpy.uint8] | None)
point (PsdPoint)
- Return type:
None
- class psdtags.PsdPoint(y, x)¶
Bases:
NamedTuplePoint.
- Parameters:
y (int)
x (int)
- y: int¶
Alias for field number 0
- x: int¶
Alias for field number 1
- __repr__()¶
Return repr(self).
- Return type:
str
- __getnewargs__()¶
Return self as a plain tuple. Used by copy and pickle.
- static __new__(_cls, y, x)¶
Create new instance of PsdPoint(y, x)
- Parameters:
y (int)
x (int)
- __replace__(**kwds)¶
Return a new PsdPoint object replacing specified fields with new values
- class psdtags.PsdRectangle(top, left, bottom, right)¶
Bases:
NamedTupleRectangle.
- Parameters:
top (int)
left (int)
bottom (int)
right (int)
- top: int¶
Alias for field number 0
- left: int¶
Alias for field number 1
- bottom: int¶
Alias for field number 2
- right: int¶
Alias for field number 3
- property shape: tuple[int, int]¶
Height and width of rectangle.
- property offset: tuple[int, int]¶
Top-left position of rectangle.
- __repr__()¶
Return repr(self).
- Return type:
str
- __getnewargs__()¶
Return self as a plain tuple. Used by copy and pickle.
- static __new__(_cls, top, left, bottom, right)¶
Create new instance of PsdRectangle(top, left, bottom, right)
- Parameters:
top (int)
left (int)
bottom (int)
right (int)
- __replace__(**kwds)¶
Return a new PsdRectangle object replacing specified fields with new values
- class psdtags.PsdReferencePoint(x, y)¶
Bases:
PsdKeyABCReference point.
- Parameters:
x (float)
y (float)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write reference point to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(x, y)¶
- Parameters:
x (float)
y (float)
- Return type:
None
- class psdtags.PsdResourceBlockABC¶
Bases:
objectAbstract base class for image resource block data.
- abstractmethod classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- classmethod frombytes(data, psdformat, resourceid, /, name)¶
Return instance from bytes.
- Parameters:
data (bytes)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
- Return type:
- abstractmethod write(fh, psdformat, /)¶
Write instance values to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- tobytes(psdformat, /)¶
Return instance values as bytes.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- __repr__()¶
Return repr(self).
- Return type:
str
- __weakref__¶
list of weak references to the object
- class psdtags.PsdResourceId(*values)¶
Bases:
IntEnumImage resource IDs.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdSectionDividerSetting(kind, blendmode=None, subtype=None)¶
Bases:
PsdKeyABCSection divider setting (Photoshop 6.0).
- Parameters:
kind (PsdSectionDividerType)
blendmode (PsdBlendMode | None)
subtype (int | None)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write section divider setting to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(kind, blendmode=None, subtype=None)¶
- Parameters:
kind (PsdSectionDividerType)
blendmode (PsdBlendMode | None)
subtype (int | None)
- Return type:
None
- class psdtags.PsdSectionDividerType(*values)¶
Bases:
IntEnumSection divider setting types.
- __format__(format_spec, /)¶
Convert to a string according to format_spec.
- __new__(value)¶
- class psdtags.PsdSheetColorSetting(color)¶
Bases:
PsdKeyABCSheet color setting (Photoshop 6.0).
- Parameters:
color (PsdColorType)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write color setting to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(color)¶
- Parameters:
color (PsdColorType)
- Return type:
None
- class psdtags.PsdString(key, value)¶
Bases:
PsdKeyABCUnicode string.
- Parameters:
key (PsdKey)
value (str)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- write(fh, psdformat, /)¶
Write unicode string to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __str__()¶
Return str(self).
- Return type:
str
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- class psdtags.PsdStringBlock(resourceid, value, name='')¶
Bases:
PsdResourceBlockABCUnicode string.
- Parameters:
resourceid (PsdResourceId)
value (str)
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write Pascal string to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, value, name='')¶
- Parameters:
resourceid (PsdResourceId)
value (str)
name (str)
- Return type:
None
- class psdtags.PsdStringsBlock(resourceid, values, name='')¶
Bases:
PsdResourceBlockABCSeries of Unicode strings.
- Parameters:
resourceid (PsdResourceId)
values (list[str])
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write sequence of Unicode strings to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, values, name='')¶
- Parameters:
resourceid (PsdResourceId)
values (list[str])
name (str)
- Return type:
None
- class psdtags.PsdTextEngineData(data)¶
Bases:
PsdKeyABCText Engine Data (Photoshop CS3).
- Parameters:
data (bytes)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write unicode string to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(data)¶
- Parameters:
data (bytes)
- Return type:
None
- class psdtags.PsdThumbnailBlock(resourceid, format, width, height, rawdata, name='')¶
Bases:
PsdResourceBlockABCThumbnail resource format.
- Parameters:
resourceid (PsdResourceId)
format (PsdThumbnailFormat)
width (int)
height (int)
rawdata (bytes)
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write Thumbnail resource format to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- property is_bgr: bool¶
Thumbnail image is BGR.
- property data: NDArray[Any]¶
Thumbnail image array.
- property title: str¶
Short representation of instance.
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, format, width, height, rawdata, name='')¶
- Parameters:
resourceid (PsdResourceId)
format (PsdThumbnailFormat)
width (int)
height (int)
rawdata (bytes)
name (str)
- Return type:
None
- class psdtags.PsdUnicodeString(value)¶
Bases:
objectUnicode string.
- Parameters:
value (str)
- classmethod read(fh, psdformat, /)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
- write(fh, psdformat, /, *, terminate=True)¶
Write unicode string to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
terminate (bool)
- Return type:
int
- __str__()¶
Return str(self).
- Return type:
str
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(value)¶
- Parameters:
value (str)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdUnknown(key, psdformat, value)¶
Bases:
PsdKeyABCUnknown keys stored as opaque bytes.
- classmethod frombytes(data, psdformat, key, /)¶
Return instance from bytes.
- Parameters:
- Return type:
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- write(fh, psdformat, /)¶
Write opaque binary value to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- tobytes(psdformat, /)¶
Return opaque binary value.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- class psdtags.PsdUserMask(colorspace=PsdColorSpaceType.UNKNOWN, components=(0, 0, 0, 0), opacity=0, flag=128)¶
Bases:
PsdKeyABCUser mask. Same as global layer mask info table.
- Parameters:
colorspace (PsdColorSpaceType)
components (tuple[int, int, int, int])
opacity (int)
flag (int)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- Parameters:
- Return type:
- tobytes(psdformat, /)¶
Return user mask record.
- Parameters:
psdformat (PsdFormat)
- Return type:
bytes
- write(fh, psdformat, /)¶
Write user mask record to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(colorspace=PsdColorSpaceType.UNKNOWN, components=(0, 0, 0, 0), opacity=0, flag=128)¶
- Parameters:
colorspace (PsdColorSpaceType)
components (tuple[int, int, int, int])
opacity (int)
flag (int)
- Return type:
None
- class psdtags.PsdVersionBlock(resourceid, version, file_version, writer_name, reader_name, has_real_merged_data, name='')¶
Bases:
PsdResourceBlockABCImage resource blocks stored as opaque bytes.
- Parameters:
resourceid (PsdResourceId)
version (int)
file_version (int)
writer_name (str)
reader_name (str)
has_real_merged_data (bool)
name (str)
- classmethod read(fh, psdformat, resourceid, /, name, length)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
resourceid (PsdResourceId)
name (str)
length (int)
- Return type:
- write(fh, psdformat, /)¶
Write instance values to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(resourceid, version, file_version, writer_name, reader_name, has_real_merged_data, name='')¶
- Parameters:
resourceid (PsdResourceId)
version (int)
file_version (int)
writer_name (str)
reader_name (str)
has_real_merged_data (bool)
name (str)
- Return type:
None
- class psdtags.PsdVirtualMemoryArray(iswritten=False, depth=None, rectangle=None, pixeldepth=None, compression=PsdCompressionType.RAW, data=None)¶
Bases:
objectVirtual memory array.
- Parameters:
iswritten (bool)
depth (int | None)
rectangle (PsdRectangle | None)
pixeldepth (int | None)
compression (PsdCompressionType)
data (NDArray[Any] | None)
- classmethod read(fh, psdformat, /)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
- write(fh, psdformat, /)¶
Write virtual memory array to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- property dtype: numpy.dtype[Any]¶
Data type of virtual memory array.
- property shape: tuple[int, int]¶
Height and width of virtual memory array.
- property offset: tuple[int, int]¶
Top-left position of virtual memory array.
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- __init__(iswritten=False, depth=None, rectangle=None, pixeldepth=None, compression=PsdCompressionType.RAW, data=None)¶
- Parameters:
iswritten (bool)
depth (int | None)
rectangle (PsdRectangle | None)
pixeldepth (int | None)
compression (PsdCompressionType)
data (NDArray[Any] | None)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdVirtualMemoryArrayList(rectangle, channels=<factory>)¶
Bases:
objectVirtual memory array list.
- Parameters:
rectangle (PsdRectangle)
channels (list[PsdVirtualMemoryArray])
- classmethod read(fh, psdformat, /)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
- write(fh, psdformat, /)¶
Write virtual memory array list to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- __init__(rectangle, channels=<factory>)¶
- Parameters:
rectangle (PsdRectangle)
channels (list[PsdVirtualMemoryArray])
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.PsdWord(key, value)¶
Bases:
PsdKeyABCFour bytes.
- Parameters:
key (PsdKey)
value (bytes)
- classmethod read(fh, psdformat, key, /, length)¶
Return instance from open file.
- write(fh, psdformat, /)¶
Write four bytes value to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
- Return type:
int
- __repr__()¶
Return repr(self).
- Return type:
str
- __eq__(other)¶
Return self==value.
- class psdtags.TiffImageResources(psdformat, blocks, name=None)¶
Bases:
objectTIFF ImageResources tag #34377.
- Parameters:
psdformat (PsdFormat)
blocks (list[PsdResourceBlockABC])
name (str | None)
- classmethod read(fh, length, name=None)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
length (int)
name (str | None)
- Return type:
- classmethod frombytes(data, name=None)¶
Return instance from ImageResources tag value.
- Parameters:
data (bytes)
name (str | None)
- Return type:
- classmethod fromtiff(filename, /, pageindex=0)¶
Return instance from ImageResources tag in TIFF file.
- Parameters:
filename (os.PathLike[Any] | str)
pageindex (int)
- Return type:
- write(fh)¶
Write ImageResources tag value to open file.
- Parameters:
fh (BinaryIO)
- Return type:
int
- tobytes()¶
Return ImageResources tag value as bytes.
- Return type:
bytes
- tifftag()¶
Return tifffile.TiffWriter.write extratags item.
- Return type:
tuple[int, int, int, bytes, bool]
- thumbnail()¶
Return thumbnail image if any, else None.
- Return type:
NDArray[Any] | None
- property blocks_dict: dict[int, PsdResourceBlockABC]¶
Dictionary of PsdResourceBlock by value.
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- __init__(psdformat, blocks, name=None)¶
- Parameters:
psdformat (PsdFormat)
blocks (list[PsdResourceBlockABC])
name (str | None)
- Return type:
None
- __weakref__¶
list of weak references to the object
- class psdtags.TiffImageSourceData(psdformat, layers, usermask, info=<factory>, name=None)¶
Bases:
objectTIFF ImageSourceData tag #37724.
- Parameters:
psdformat (PsdFormat)
layers (PsdLayers)
usermask (PsdUserMask)
info (list[PsdKeyABC])
name (str | None)
- classmethod read(fh, /, name=None, *, unknown=True)¶
Return instance from open file.
- Parameters:
fh (BinaryIO)
name (str | None)
unknown (bool)
- Return type:
- classmethod frombytes(data, /, *, name=None, unknown=True)¶
Return instance from bytes.
- Parameters:
data (bytes)
name (str | None)
unknown (bool)
- Return type:
- classmethod fromtiff(filename, /, *, pageindex=0, unknown=True)¶
Return instance from TIFF file.
- Parameters:
filename (os.PathLike[Any] | str)
pageindex (int)
unknown (bool)
- Return type:
- write(fh, /, psdformat=None, *, compression=None, unknown=True, maxworkers=1)¶
Write ImageResourceData tag value to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat | bytes | None)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
int
- tobytes(psdformat=None, *, compression=None, unknown=True, maxworkers=1)¶
Return ImageResourceData tag value as bytes.
- Parameters:
psdformat (PsdFormat | bytes | None)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
bytes
- tifftag(psdformat=None, compression=None, *, unknown=True, maxworkers=1)¶
Return tifffile.TiffWriter.write extratags item.
- Parameters:
psdformat (PsdFormat | bytes | None)
compression (PsdCompressionType | None)
unknown (bool)
maxworkers (int)
- Return type:
tuple[int, int, int, bytes, bool]
- property byteorder: Literal['>', '<']¶
Byte-order of PSD structures.
- property has_unknowns: bool¶
ImageSourceData has unknown structures in info or layers.
- __hash__()¶
Return hash(self).
- Return type:
int
- __eq__(other)¶
Return self==value.
- Parameters:
other (object)
- Return type:
bool
- __repr__()¶
Return repr(self).
- Return type:
str
- __init__(psdformat, layers, usermask, info=<factory>, name=None)¶
- Parameters:
psdformat (PsdFormat)
layers (PsdLayers)
usermask (PsdUserMask)
info (list[PsdKeyABC])
name (str | None)
- Return type:
None
- __weakref__¶
list of weak references to the object
- psdtags.compress(data, compression, rlecountfmt)¶
Return compressed big-endian numpy array.
- Parameters:
data (NDArray[Any])
compression (PsdCompressionType)
rlecountfmt (str)
- Return type:
bytes
- psdtags.decompress(data, compression, shape, dtype, rlecountfmt)¶
Return decompressed numpy array.
- Parameters:
data (bytes | bytearray)
compression (PsdCompressionType)
shape (tuple[int, ...])
dtype (DTypeLike)
rlecountfmt (str)
- Return type:
NDArray[Any]
- psdtags.overlay(*layers, shape=None, vmax=None)¶
Return overlay of image layers with unassociated alpha channels.
Consider using image-blender for an implementation of Adobe Photoshop’s blend modes.
- Parameters:
layers (tuple[NDArray[Any], tuple[int, int] | None]) – RGBA image array and offset of layer in canvas. Layers must not exceed the canvas boundaries and must all have the same data types. Alpha channels are unassociated.
shape (tuple[int, ...] | None) – Canvas height and width. By default, this is determined from the first layer.
vmax (float | None) – Value used to normalize layer values. By default, this is determined from data type of the first layer.
- Returns:
Overlay of image layers.
- Return type:
NDArray[Any]
- psdtags.read_psdblocks(fh, /, length)¶
Return list of image resource block values from open file.
- Parameters:
fh (BinaryIO)
length (int)
- Return type:
list[PsdResourceBlockABC]
- psdtags.read_psdtags(fh, psdformat, /, length, *, unknown=True, align=2)¶
Return list of tags from open file.
- psdtags.read_tifftag(filename, tag, /, pageindex=0)¶
Return tag value from TIFF file.
- Parameters:
filename (os.PathLike[Any] | str)
tag (int | str)
pageindex (int)
- Return type:
Any
- psdtags.write_psdblocks(fh, /, *blocks)¶
Write sequence of blocks to open file.
- Parameters:
fh (BinaryIO)
blocks (PsdResourceBlockABC)
- Return type:
int
- psdtags.write_psdtags(fh, psdformat, /, compression, maxworkers, align, *, unknown=True, tags)¶
Write sequence of tags to open file.
- Parameters:
fh (BinaryIO)
psdformat (PsdFormat)
compression (PsdCompressionType | None)
maxworkers (int)
align (int)
unknown (bool)
tags (Sequence[PsdKeyABC])
- Return type:
int
- psdtags.REPR_MAXLEN = 24¶
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4