photoshop_fit_layer_to_document
Scale the active layer to fit or fill the document canvas while preserving aspect ratio. Use it when a placed layer must match canvas size.
Instructions
Scale the active layer to the document canvas, keeping aspect ratio. fillDocument: false (default) fits inside and may letterbox; true covers the canvas and may crop the layer.
Use when: a placed layer should match the canvas size. Do NOT use when: you want a specific percent — use photoshop_scale_layer. Do NOT use when: the document canvas itself should change size — use photoshop_resize_image or photoshop_crop_document.
Returns: confirmation of the fit. Preconditions: active document and active layer. Side effects: transforms that layer. Does not change document dimensions. Reversible with photoshop_undo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Photoshop document id from photoshop_get_state / photoshop_list_documents. Send null or 0 to use the active document. A positive number activates that document before the tool runs. When no document is open, a stale id does not block the call. | |
| fillDocument | No | If true, fills entire canvas (may crop). If false, fits within canvas (may have margins). Default: false |