pytoshop.blending_range

Manage blending ranges.

class pytoshop.blending_range.BlendingRange(black0=0, black1=0, white0=0, white1=0, _values=None)[source]

Bases: object

Blending range data.

Comprises 2 black values and 2 white values.

black0
black1
classmethod read(fd)[source]

Instantiate from a file-like object.

Parameters:
  • fd (file-like object) – Must be readable, seekable and open in binary mode.
  • header (PsdFile object) – An object to get global file information from.
white0
white1
write(fd, header)[source]

Write to a file-like object.

Parameters:
  • fd (file-like object) – Must be writable, seekable and open in binary mode.
  • header (PsdFile object) – An object to get global file information from.
class pytoshop.blending_range.BlendingRangePair(src=None, dst=None)[source]

Bases: object

Blending range pair.

The combination of a source and destination blending range.

dst
length(header)[source]

The length of the section, in bytes, not including its header.

classmethod read(fd)[source]

Instantiate from a file-like object.

Parameters:
  • fd (file-like object) – Must be readable, seekable and open in binary mode.
  • header (PsdFile object) – An object to get global file information from.
src
total_length(header)[source]

The length of the section, in bytes, including its header.

write(fd, header)[source]

Write to a file-like object.

Parameters:
  • fd (file-like object) – Must be writable, seekable and open in binary mode.
  • header (PsdFile object) – An object to get global file information from.
class pytoshop.blending_range.BlendingRanges(composite_gray_blend=None, channels=None)[source]

Bases: object

All of the layer blending range data.

Consists of a composite gray blend pair followed by N additional pairs.

channels

List of additional BlendingRangePair instances.

composite_gray_blend

Composite gray BlendingRangePair.

length(header)[source]

The length of the section, in bytes, not including its header.

classmethod read(fd, num_channels)[source]

Instantiate from a file-like object.

Parameters:
  • fd (file-like object) – Must be readable, seekable and open in binary mode.
  • header (PsdFile object) – An object to get global file information from.
total_length(header)[source]

The length of the section, in bytes, including its header.

write(fd, header)[source]

Write to a file-like object.

Parameters:
  • fd (file-like object) – Must be writable, seekable and open in binary mode.
  • header (PsdFile object) – An object to get global file information from.