---
Product: psd
Platform: python
Page Type: reference
Canonical URL: https://reference.aspose.org/psd/python/layerandmasksection
---

# LayerAndMaskSection

## Overview

`LayerAndMaskSection` is a class in Aspose.PSD FOSS for Python.

Represents the PSD/PSB Layer and Mask Information section and its

    raw-preserved save state.

This class declares 5 methods for LayerAndMaskSection objects in Python programs.
Available methods include: `__init__`, `empty`, `load`, `save`, `with_layers`.
Public members are accessible to any Python application after installing the Aspose.PSD FOSS for Python package.
Properties: `has_layer_collection_mutated`, `layer_channel_image_data_raw`, `layer_count_raw`, `layer_global_mask_and_tail_raw`, `layers`, `raw_section_bytes`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `raw_section_bytes` | `bytes` | Read | Gets the raw section payload without the outer length field. |
| `layer_channel_image_data_raw` | `bytes` | Read | Gets the raw layer channel image data payload after layer records. |
| `layer_global_mask_and_tail_raw` | `bytes` | Read | Gets the raw global mask info and trailing section bytes. |
| `layer_count_raw` | `int` | Read | Gets the original signed layer count so transparency-protected layers can preserve sign. |
| `layers` | `List[Layer]` | Read | Gets the parsed layer records. |
| `has_layer_collection_mutated` | `bool` | Read | Gets whether the public layer collection was replaced. |

## Methods

| Signature | Description |
|-----------|-------------|
| `__init__(raw_section_bytes: bytes, layer_channel_image_data_raw: bytes, layer_global_mask_and_tail_raw: bytes, layer_count_raw: int, layers: List[Layer], has_layer_collection_mutated: bool)` | Initializes a new instance of the :class:`LayerAndMaskSection` class. |
| `empty()` → `"LayerAndMaskSection"` | Gets an empty Layer and Mask Information section. |
| `load(reader: BigEndianReader, is_large_document: bool)` → `"LayerAndMaskSection"` | Calls load(reader, is_large_document) on this LayerAndMaskSection instance. |
| `save(writer: BigEndianWriter, is_large_document: bool)` | Calls save(writer, is_large_document) on this LayerAndMaskSection instance. |
| `with_layers(layers: List[Layer])` → `"LayerAndMaskSection"` | Creates a section copy with a replaced layer collection and marks it for rewriting on save. |

## See Also

- [Aspose.PSD for Python — Enterprise API Reference](https://reference.aspose.com/psd/python-net/)