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)[source]

Image resources section of the PSD file. Dict of ImageResource.

get_data(key, default=None)[source]

Get data from the image resources.

Shortcut for the following:

if key in image_resources:
    value = tagged_blocks[key].data
classmethod new(**kwargs)[source]

Create a new default image resouces.

Returns:

ImageResources

ImageResource

class psd_tools.psd.image_resources.ImageResource(signature: bytes = b'8BIM', key: int = 1000, name: str = '', data: bytes = b'')[source]

Image resource block.

signature

Binary signature, always b'8BIM'.

key

Unique identifier for the resource. See Resource.

name
data

The resource data.

AlphaIdentifiers

class psd_tools.psd.image_resources.AlphaIdentifiers(items=NOTHING)[source]

List of alpha identifiers.

AlphaNamesPascal

class psd_tools.psd.image_resources.AlphaNamesPascal(items=NOTHING)[source]

List of alpha names.

AlphaNamesUnicode

class psd_tools.psd.image_resources.AlphaNamesUnicode(items=NOTHING)[source]

List of alpha names.

Byte

class psd_tools.psd.image_resources.Byte(value=0)[source]

Byte element.

GridGuidesInfo

class psd_tools.psd.image_resources.GridGuidesInfo(version: int = 1, horizontal: int = 0, vertical: int = 0, data=NOTHING)[source]

Grid and guides info structure.

HalftoneScreens

class psd_tools.psd.image_resources.HalftoneScreens(items=NOTHING)[source]

Halftone screens.

HalftoneScreen

class psd_tools.psd.image_resources.HalftoneScreen(freq: int = 0, unit: int = 0, angle: int = 0, shape: int = 0, use_accurate: bool = False, use_printer: bool = False)[source]

Halftone screen.

freq
unit
angle
shape
use_accurate
use_printer

Integer

class psd_tools.psd.image_resources.Integer(value=0)[source]

Integer element.

LayerGroupEnabledIDs

class psd_tools.psd.image_resources.LayerGroupEnabledIDs(items=NOTHING)[source]

Layer group enabled ids.

LayerGroupInfo

class psd_tools.psd.image_resources.LayerGroupInfo(items=NOTHING)[source]

Layer group info list.

LayerSelectionIDs

class psd_tools.psd.image_resources.LayerSelectionIDs(items=NOTHING)[source]

Layer selection ids.

ShortInteger

class psd_tools.psd.image_resources.ShortInteger(value=0)[source]

Short integer element.

PascalString

class psd_tools.psd.image_resources.PascalString(value=None)[source]

Pascal string element.

PixelAspectRatio

class psd_tools.psd.image_resources.PixelAspectRatio(value=0.0, version: int = 1)[source]

Pixel aspect ratio.

PrintFlags

class psd_tools.psd.image_resources.PrintFlags(labels: bool = False, crop_marks: bool = False, colorbars: bool = False, registration_marks: bool = False, negative: bool = False, flip: bool = False, interpolate: bool = False, caption: bool = False, print_flags=None)[source]

Print flags.

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)[source]

Print flags info structure.

version
center_crop
bleed_width_value
bleed_width_scale

PrintScale

class psd_tools.psd.image_resources.PrintScale(style=PrintScaleStyle.CENTERED, x: float = 0.0, y: float = 0.0, scale: float = 0.0)[source]

Print scale structure.

style
x
y
scale

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)[source]

Resoulution info structure.

horizontal
horizontal_unit
width_unit
vertical
vertical_unit
height_unit

Slices

class psd_tools.psd.image_resources.Slices(version: int = 0, data=None)[source]

Slices resource.

version
data

SlicesV6

class psd_tools.psd.image_resources.SlicesV6(bbox=NOTHING, name: str = '', items=NOTHING)[source]

Slices resource version 6.

bbox
name
items

SliceV6

class psd_tools.psd.image_resources.SliceV6(slice_id: int = 0, group_id: int = 0, origin: int = 0, associated_id=None, name: str = '', slice_type: int = 0, bbox=NOTHING, url: str = '', target: str = '', message: str = '', alt_tag: str = '', cell_is_html: bool = False, cell_text: str = '', horizontal_align: int = 0, vertical_align: int = 0, alpha: int = 0, red: int = 0, green: int = 0, blue: int = 0, data=None)[source]

Slice element for version 6.

slice_id
group_id
origin
associated_id
name
slice_type
bbox
url
target
message
alt_tag
cell_is_html
cell_text
horizontal
vertical
alpha
red
green
blue
data

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'')[source]

Thumbnail resource structure.

fmt
width
height
row
total_size
size
bits
planes
data
topil()[source]

Get PIL Image.

Returns:

PIL Image object.

ThumbnailResourceV4

class psd_tools.psd.image_resources.ThumbnailResourceV4(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'')[source]

TransferFunctions

class psd_tools.psd.image_resources.TransferFunctions(items=NOTHING)[source]

Transfer functions.

TransferFunction

class psd_tools.psd.image_resources.TransferFunction(curve=NOTHING, override: bool = False)[source]

Transfer function

URLList

class psd_tools.psd.image_resources.URLList(items=NOTHING)[source]

URL list structure.

URLItem

class psd_tools.psd.image_resources.URLItem(number: int = 0, id: int = 0, name: str = '')[source]

URL item.

number
id
name

VersionInfo

class psd_tools.psd.image_resources.VersionInfo(version: int = 1, has_composite: bool = False, writer: str = '', reader: str = '', file_version: int = 1)[source]

Version info structure.

version
has_composite
writer
reader
file_version