Repository navigation
Conversation
… four corners enclose With Perspective on, each corner of the crop frame moves on its own, and Apply takes what lies inside them to an upright rectangle: a document, sign or painting photographed at an angle comes out square. The size is the mean of each pair of opposite sides. The frame shows a grid drawn in the same perspective, to line up with something square in the picture. Every layer goes through the same perspective, as Image Size resamples them: 16-bit layers stay 16-bit, linked masks crop with their layer, folders and adjustment layers cover the new canvas, and live text and shapes become pixels. Core Image samples back from each output pixel, so it holds when the vanishing point falls inside the picture. Animated GIF layers are refused rather than flattened. Refs robbietilton#206.
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #206. The Crop tool's bar gets a Perspective switch, with no new menu item. With it on, each corner of the frame moves on its own. Dragging inside moves the whole shape, and dragging outside starts a new frame. Apply or Return takes what lies inside the corners to an upright rectangle. The frame shows a 4 × 4 grid in the same perspective, to line up with something square in the picture.
How it works (
PerspectiveCrop.swift)CIPerspectiveCorrectionwasn't used: a 400-over-800 trapezoid came out 800 × 1265.Not included: width and height fields, or a front-image size the way Photoshop has. Happy to add those if you want them.
Testing
PerspectiveCropTests:DistortWarpcomes out upright, with each color in its quadrant and the corners filled.CompositorTestson macOS 27: 884 pass and 2 fail. The 2 areExternalChangeTeststimeouts (about 105 s each, waiting on file events). All sixExternalChangeTestspass when run on their own.🤖 Generated with Claude Code
https://claude.ai/code/session_01WC9aF7W8inTF7p9LZbNXRe