pytoshop.enums

Enumerated values used throughout the library.

class pytoshop.enums.BlendMode[source]

Bases: bytes, enum.Enum

Layer blend mode.

color = b'colr'
color_burn = b'idiv'
color_dodge = b'div '
darken = b'dark'
darker_color = b'dkCl'
difference = b'diff'
dissolve = b'diss'
divide = b'fdiv'
exclusion = b'smud'
hard_light = b'hLit'
hard_mix = b'hMix'
hue = b'hue '
lighten = b'lite'
lighter_color = b'lgCl'
linear_burn = b'lbrn'
linear_dodge = b'lddg'
linear_light = b'lLit'
luminosity = b'lum '
multiply = b'mul '
normal = b'norm'
overlay = b'over'
pass_through = b'pass'
pin_light = b'pLit'
saturation = b'sat '
screen = b'scrn'
soft_light = b'sLit'
subtract = b'fsub'
vivid_light = b'vLit'
class pytoshop.enums.ChannelId[source]

Bases: enum.IntEnum

Channel id.

Used to map channel data to image planes in layers.

The meaning of the positive numbers depends on the ColorMode in effect.

L = 0
a = 1
b = 2
bitmap = 0
black = 3
blue = 2
cyan = 0
default = 0
gray = 0
green = 1
magenta = 1
real_user_layer_mask = -3
red = 0
transparency = -1
user_layer_mask = -2
yellow = 2
class pytoshop.enums.ColorChannel[source]

Bases: enum.IntEnum

Color channel names, with unique values so we can check that they apply to the expected color mode.

L = 10
a = 11
b = 12
bitmap = 0
black = 9
blue = 5
cyan = 6
default = 2
gray = 1
green = 4
magenta = 7
real_user_layer_mask = -3
red = 3
transparency = -1
user_layer_mask = -2
yellow = 8
class pytoshop.enums.ColorDepth[source]

Bases: enum.IntEnum

Color depth (bits-per-pixel-per-channel).

Supported values are 1, 8, 16, and 32.

depth1 = 1
depth16 = 16
depth32 = 32
depth8 = 8
class pytoshop.enums.ColorMode[source]

Bases: enum.IntEnum

Color mode.

bitmap = 0
cmyk = 4
duotone = 8
grayscale = 1
indexed = 2
lab = 9
multichannel = 7
rgb = 3
class pytoshop.enums.ColorSpace[source]

Bases: enum.IntEnum

Color space ids.

Defines the meaning of the 4 color values in a color structure.

  • rgb: The first three values are red, green, and blue. The are full 16-bit unsigned values as in Apple’s RGBColor data structure.
  • hsb: The first three values are hue, saturation, and brightness. The are full unsigned 16-bit values as in Apple’s HSVColor data structure.
  • cmyk: The four values are cyan, magenta, yellow and black. The are full unsigned 16-bit values. 0 = 100% ink.
  • lab: The first three values are lightness, a chrominance, and b chrominance. Lightness is a 16-bit value from 0 to 10000. Chrominance components are each 16-bit values from -12800 to 12700. Gray values are represented by chrominance components of 0.
  • grayscale: The first value in the color data is the gray value from 0 to 10000.

Additional values are for “custom color spaces” which are not as well documented:

  • pantone: Pantone® matching system.
  • focoltone: Focoltone matching system.
  • trumatch: Trumatch color.
  • toyo_88_colorfinder_1050: Toyo 88 colorfinder 1050.
  • hks: HKS colors.
cmyk = 2
focoltone = 4
grayscale = 8
hks = 10
hsb = 1
lab = 7
pantone = 3
rgb = 0
toyo_88_colorfinder_1050 = 6
trumatch = 5
class pytoshop.enums.Compression[source]

Bases: enum.IntEnum

Compression mode.

  • raw: raw image data.
  • rle: Run length encoded (RLE) compressed. The RLE compression is the same compression algorithm used by the Macintosh ROM routine PackBits, and the TIFF standard.
  • zip: Zip (zlib) without prediction.
  • zip_prediction: Zip (zlib) with prediction.
raw = 0
rle = 1
zip = 2
zip_prediction = 3
class pytoshop.enums.GuideDirection[source]

Bases: enum.IntEnum

An enumeration.

horizontal = 1
vertical = 0
class pytoshop.enums.ImageResourceID[source]

Bases: enum.IntEnum

Ids for Image Resource blocks.

alpha_channel_names = 1006
alpha_identifiers = 1053
alternate_duotone_colors = 1066
alternate_spot_colors = 1067
auto_save_file_path = 1086
auto_save_format = 1087
background_color = 1010
border_info = 1009
caption = 1008
caption_digest = 1061
color_halftoning_info = 1013
color_samplers_resource = 1073
color_transfer_funcs = 1016
copyright_flag = 1034
count_info = 1080
display_info = 1077
document_specific_ids_seed_number = 1044
duotone_halftoning_info = 1014
duotone_image_info = 1018
duotone_transfer_funcs = 1017
effective_black_and_white = 1019
effects_visible = 1042
eps_options = 1021
exif_data_1 = 1058
exif_data_2 = 1059
global_altitude = 1049
global_angle = 1037
grayscale_and_multichannel_halftoning_info = 1012
grayscale_and_multichannel_transfer_func = 1015
grid_and_guides_info = 1032
hdr_toning_info = 1070
icc_profile = 1039
icc_untagged_profile = 1041
image_mode_for_raw = 1029
image_ready_7_rollover_expanded_state = 7003
image_ready_data_sets = 7001
image_ready_default_selected_state = 7002
image_ready_rollover_expanded_state = 7004
image_ready_save_layer_settings = 7005
image_ready_variables = 7000
image_ready_version = 7006
indexed_color_table_count = 1046
iptc_naa = 1028
jpeg_quality = 1030
jump_to_xpep = 1052
layer_comps = 1065
layer_groups_enabled = 1072
layer_selection_ids = 1069
layer_state_info = 1024
layers_group_info = 1026
lightroom_workflow = 8000
mac_nsprintinfo = 1084
mac_page_format_info = 1002
mac_print_info = 1001
measurement_scale = 1074
name_of_clipping_path = 2999
onion_skins = 1078
origin_path_info = 3000
path_selection_state = 1088
pixel_aspect_ratio = 1064
print_flags = 1011
print_flags_info = 10000
print_info = 1071
print_info_cs5 = 1082
print_scale = 1062
print_style = 1083
quick_mask_info = 1022
resolution_info = 1005
sheet_disclosure = 1076
slices = 1050
spot_halftone = 1043
thumbnail_resource = 1036
timeline_info = 1075
transparency_index = 1047
unicode_alpha_names = 1045
url = 1035
url_list = 1054
version_info = 1057
watermark = 1040
win_devmode = 1085
workflow_url = 1051
xmp_metadata = 1060
class pytoshop.enums.LayerMaskKind[source]

Bases: enum.IntEnum

Layer mask kind.

According to the spec, only use_value_stored_per_layer is preferred. The other are retained for backward compatibility only.

color_protected = 1
color_selected = 0
use_value_stored_per_layer = 128
class pytoshop.enums.PathRecordType[source]

Bases: enum.IntEnum

An enumeration.

clipboard_record = 7
closed_subpath_bezier_knot_linked = 1
closed_subpath_bezier_knot_unlinked = 2
closed_subpath_length = 0
initial_fill_rule_record = 8
open_subpath_bezier_knot_linked = 4
open_subpath_bezier_knot_unlinked = 5
open_subpath_length = 3
path_fill_rule_record = 6
class pytoshop.enums.PrintScaleStyle[source]

Bases: enum.IntEnum

An enumeration.

centered = 0
size_to_fit = 1
user_defined = 2
class pytoshop.enums.SectionDividerSetting[source]

Bases: enum.IntEnum

Section divider setting.

Used for the mode of grouped layers.

  • any_other: any other type of layer
  • open: Display an open folder
  • closed: Display a closed folder
  • bounding: Bounding section divider, hidden in GUI.
any_other = 0
bounding = 3
closed = 2
open = 1
class pytoshop.enums.Units[source]

Bases: enum.IntEnum

An enumeration.

cm = 2
columns = 5
inches = 1
picas = 4
points = 3
class pytoshop.enums.Version[source]

Bases: enum.IntEnum

The PSD file version.

Version 1 is the classic “PSD” file.

Version 2 is the large document format “PSB” file which supports documents up to 300,000 pixels in any dimension.

psb = 2
psd = 1
version_1 = 1
version_2 = 2