photoshop_crop_document
Crop the active Photoshop document to a pixel rectangle, deleting outside pixels and shrinking the canvas. Use when explicit pixel bounds are provided.
Instructions
Crop the active document to a pixel rectangle (left, top, right, bottom). Pixels outside that rectangle are deleted and the canvas shrinks.
Use when: the user gives explicit crop bounds in pixels. Do NOT use when: only one layer should scale inside the existing canvas — use photoshop_fit_layer_to_document or photoshop_scale_layer. Do NOT use when: the whole image should be resampled to a new width and height — use photoshop_resize_image.
Returns: the new document width and height. Preconditions: active document; right > left and bottom > top. Side effects: destructive crop of every layer, one history step. Reversible with photoshop_undo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | Yes | Top edge position in pixels | |
| left | Yes | Left edge position in pixels | |
| right | Yes | Right edge position in pixels | |
| bottom | Yes | Bottom edge position in pixels | |
| 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. |