from __future__ import absolute_import, unicode_literals, print_function import warnings import collections import io from psd_tools.constants import TaggedBlock, SectionDivider from psd_tools.decoder.actions import decode_descriptor, UnknownOSType from psd_tools.utils import read_fmt, read_unicode_string, unpack from psd_tools.decoder import decoders, layer_effects from psd_tools.reader.layers import Block from psd_tools.debug import pretty_namedtuple _tagged_block_decoders, register = decoders.new_registry() _tagged_block_decoders.update({ TaggedBlock.BLEND_CLIPPING_ELEMENTS: decoders.boolean("I"), TaggedBlock.BLEND_INTERIOR_ELEMENTS: decoders.boolean("I"), TaggedBlock.KNOCKOUT_SETTING: decoders.boolean("I"), TaggedBlock.UNICODE_LAYER_NAME: decoders.unicode_string, TaggedBlock.LAYER_ID: decoders.single_value("I"), # XXX: there are more fields in docs, but they seem to be incorrect TaggedBlock.EFFECTS_LAYER: layer_effects.decode, TaggedBlock.OBJECT_BASED_EFFECTS_LAYER_INFO: layer_effects.decode_object_based }) SolidColorSettings = pretty_namedtuple('SolidColorSettings', 'version data') MetadataItem = pretty_namedtuple('MetadataItem', 'sig key copy_on_sheet_duplication data') ProtectedSetting = pretty_namedtuple('ProtectedSetting', 'transparency, composite, position') TypeToolObjectSetting = pretty_namedtuple('TypeToolObjectSetting', 'version xx xy yx yy tx ty text_version descriptor1_version text_data ' 'warp_version descriptor2_version warp_data left top right bottom')
import warnings import collections from psd_tools.utils import (read_pascal_string, unpack, read_fmt, read_unicode_string, be_array_from_bytes, decode_fixed_point_32bit) from psd_tools.constants import ImageResourceID, PrintScaleStyle, DisplayResolutionUnit, DimensionUnit from psd_tools.decoder import decoders from psd_tools.decoder.actions import decode_descriptor, UnknownOSType _image_resource_decoders, register = decoders.new_registry() _image_resource_decoders.update({ ImageResourceID.LAYER_STATE_INFO: decoders.single_value("H"), ImageResourceID.WATERMARK: decoders.single_value("B"), ImageResourceID.ICC_UNTAGGED_PROFILE: decoders.boolean(), ImageResourceID.EFFECTS_VISIBLE: decoders.boolean(), ImageResourceID.IDS_SEED_NUMBER: decoders.single_value("I"), ImageResourceID.INDEXED_COLOR_TABLE_COUNT: decoders.single_value("H"), ImageResourceID.TRANSPARENCY_INDEX: decoders.single_value("H"), ImageResourceID.GLOBAL_ALTITUDE: decoders.single_value("I"), ImageResourceID.GLOBAL_ANGLE_OBSOLETE: decoders.single_value("I"), ImageResourceID.COPYRIGHT_FLAG: decoders.boolean("H"), ImageResourceID.ALPHA_NAMES_UNICODE: decoders.unicode_string, ImageResourceID.WORKFLOW_URL: decoders.unicode_string, }) PrintScale = collections.namedtuple('PrintScale', 'style, x, y, scale') PrintFlags = collections.namedtuple('PrintFlags', 'labels, crop_marks, color_bars, registration_marks, negative, flip, interpolate, caption, print_flags') PrintFlagsInfo = collections.namedtuple('PrintFlagsInfo', 'version, center_crop_marks, bleed_width_value, bleed_width_scale')
read_unicode_string, be_array_from_bytes, decode_fixed_point_32bit) from psd_tools.constants import ImageResourceID, PrintScaleStyle, DisplayResolutionUnit, DimensionUnit from psd_tools.decoder import decoders from psd_tools.decoder.actions import decode_descriptor, UnknownOSType from psd_tools.decoder.color import decode_color _image_resource_decoders, register = decoders.new_registry() _image_resource_decoders.update({ ImageResourceID.LAYER_STATE_INFO: decoders.single_value("H"), ImageResourceID.WATERMARK: decoders.single_value("B"), ImageResourceID.ICC_UNTAGGED_PROFILE: decoders.boolean(), ImageResourceID.EFFECTS_VISIBLE: decoders.boolean(), ImageResourceID.IDS_SEED_NUMBER: decoders.single_value("I"), ImageResourceID.INDEXED_COLOR_TABLE_COUNT: decoders.single_value("H"), ImageResourceID.TRANSPARENCY_INDEX: decoders.single_value("H"), ImageResourceID.GLOBAL_ALTITUDE: decoders.single_value("I"), ImageResourceID.GLOBAL_ANGLE_OBSOLETE: decoders.single_value("I"), ImageResourceID.COPYRIGHT_FLAG: decoders.boolean("H"), ImageResourceID.ALPHA_NAMES_UNICODE:
import collections import io from psd_tools.decoder.parseEngineData import paresr from psd_tools.constants import TaggedBlock, SectionDivider, OSType from psd_tools.decoder.actions import decode_descriptor, UnknownOSType from psd_tools.utils import read_fmt, unpack from psd_tools.decoder import decoders, layer_effects from psd_tools.reader.layers import Block from psd_tools.debug import pretty_namedtuple _tagged_block_decoders, register = decoders.new_registry() _tagged_block_decoders.update({ TaggedBlock.BLEND_CLIPPING_ELEMENTS: decoders.boolean("I"), TaggedBlock.BLEND_INTERIOR_ELEMENTS: decoders.boolean("I"), TaggedBlock.KNOCKOUT_SETTING: decoders.boolean("I"), TaggedBlock.UNICODE_LAYER_NAME: decoders.unicode_string, TaggedBlock.LAYER_ID: decoders.single_value( "I" ), # XXX: there are more fields in docs, but they seem to be incorrect TaggedBlock.EFFECTS_LAYER: layer_effects.decode, TaggedBlock.OBJECT_BASED_EFFECTS_LAYER_INFO: layer_effects.decode_object_based, TaggedBlock.LFXS:
from psd_tools.utils import (read_pascal_string, unpack, read_fmt, read_unicode_string, be_array_from_bytes, decode_fixed_point_32bit) from psd_tools.constants import (ImageResourceID, PrintScaleStyle, DisplayResolutionUnit, DimensionUnit) from psd_tools.decoder import decoders from psd_tools.decoder.actions import decode_descriptor, UnknownOSType, RawData from psd_tools.decoder.color import decode_color from psd_tools.decoder.path import decode_path_resource _image_resource_decoders, register = decoders.new_registry() _image_resource_decoders.update({ ImageResourceID.LAYER_STATE_INFO: decoders.single_value("H"), ImageResourceID.WATERMARK: decoders.single_value("B"), ImageResourceID.ICC_UNTAGGED_PROFILE: decoders.boolean(), ImageResourceID.EFFECTS_VISIBLE: decoders.boolean(), ImageResourceID.IDS_SEED_NUMBER: decoders.single_value("I"), ImageResourceID.INDEXED_COLOR_TABLE_COUNT: decoders.single_value("H"), ImageResourceID.TRANSPARENCY_INDEX: decoders.single_value("H"), ImageResourceID.GLOBAL_ALTITUDE: decoders.single_value("i"), ImageResourceID.GLOBAL_ANGLE: decoders.single_value("i"), ImageResourceID.COPYRIGHT_FLAG: decoders.boolean("H"), ImageResourceID.ALPHA_NAMES_UNICODE: decoders.unicode_string, ImageResourceID.WORKFLOW_URL: decoders.unicode_string, ImageResourceID.AUTO_SAVE_FILE_PATH: decoders.unicode_string, ImageResourceID.AUTO_SAVE_FORMAT: decoders.unicode_string, })
decode_descriptor, UnknownOSType, RawData ) from psd_tools.utils import ( read_fmt, unpack, read_unicode_string, read_pascal_string ) from psd_tools.decoder import decoders, layer_effects from psd_tools.decoder.color import decode_color from psd_tools.decoder.path import decode_path_resource from psd_tools.reader.layers import Block from psd_tools.debug import pretty_namedtuple from psd_tools.decoder import engine_data _tagged_block_decoders, register = decoders.new_registry() _tagged_block_decoders.update({ TaggedBlock.BLEND_CLIPPING_ELEMENTS: decoders.boolean("I"), TaggedBlock.BLEND_INTERIOR_ELEMENTS: decoders.boolean("I"), TaggedBlock.BLEND_FILL_OPACITY: decoders.single_value("4B"), TaggedBlock.KNOCKOUT_SETTING: decoders.boolean("I"), TaggedBlock.UNICODE_LAYER_NAME: decoders.unicode_string, # XXX: there are more fields in docs, but they seem to be incorrect TaggedBlock.LAYER_ID: decoders.single_value("I"), TaggedBlock.EFFECTS_LAYER: layer_effects.decode, TaggedBlock.OBJECT_BASED_EFFECTS_LAYER_INFO: layer_effects.decode_object_based, TaggedBlock.OBJECT_BASED_EFFECTS_LAYER_INFO_V0: layer_effects.decode_object_based, TaggedBlock.OBJECT_BASED_EFFECTS_LAYER_INFO_V1: layer_effects.decode_object_based, TaggedBlock.USING_ALIGNED_RENDERING: decoders.boolean("I"), TaggedBlock.LAYER_VERSION: decoders.single_value("I"),