Stimutilated Posted February 3 Posted February 3 Question: How do you select the maximum non-rotated rectangle of intersection between multiple layers that doesn't include transparency? Scenario: I sometimes use the stack feature to align many photos to make GIF's or short videos. The photos are taken handheld so the framing varies a little with each shot so if you view the layers/photos of the stack individually you will see transparent edges. What I want to do is select the biggest non-rotated rectangle that encompasses all individual layers/photos without including any transparency. Then I can easily crop and export. The best solution I've found: Create a composite mask and drag in a copy of all desired layers/photos. By default this masks out transparent content from all layers/photos, leaving only pixels with content present in all. However, the result usually has irregular or rotated edges. Manually crop to the minimum area, paying careful attention to the full length of all edges because the compound mask could potentially end up with irregular edges and have a slight bow tie shape from where layers/photos were rotated such as for alignment when stacking. That 2nd step is frustratingly painstaking as it requires having to zoom and scroll so much and accurately adjusting corner nodes is a slippery chore. It seems to me there should be something for selecting the non-rotated rectangular area of intersection as this is an obvious target for cropping even when not doing stacks or anything complicated. Other things I've tried: Ctrl+Click to select the content of a layer and then Shift+Ctrl+Click to add selection of subsequent layer content. This ends up selecting transparency. Select>Alpha Range>Opaque (or any other option) is not helpful since you cannot use any of the modifier keys to additively select/deselect and also because it only works on a single layer, even when you have multiple selected. The lacking implementation of alpha range selection is a huge letdown. Using the Flood Select to additively select the transparency from each photo and then inverting the combined selection. This is terribly laborious and still leaves irregular or rotated edges. Quote
Staff Callum Posted February 5 Staff Posted February 5 Hi Stimulilated, If possible could you provide an example of what you are trying to do so I can make sure we are on the same page? Thanks C Quote Please tag me using @ in your reply so I can be sure to respond ASAP.
Stimutilated Posted February 5 Author Posted February 5 Thanks for responding, @Callum. I tried to explain it in the scenario description but maybe this illustration can clarify. This mocks up two layers/photos that are intersecting/overlapping and the selection I would want from them. The selection represents the largest non-rotated rectangle that covers content from all of the selected layers/photos. Also, here is an example of why this is useful. This is a sequence of photos that needed to be stacked, which left many of them realigned and rotated. I painstakingly determined the desired selection rectangle mentioned above and was able to make this GIF with stable framing. Quote
David in Яuislip Posted February 5 Posted February 5 My very best sideways thinking On each image set blend mode to Darker Colour and fx as below This shows you the limits of each photo' then use guides to determine the rectangle Quote Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10
Ldina Posted February 5 Posted February 5 14 minutes ago, David in Яuislip said: My very best sideways thinking 🤣 Love it! David in Яuislip 1 Quote 2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet
Stimutilated Posted February 6 Author Posted February 6 @David in Яuislip That's some good outside the box thinking and a tool I'll keep in my belt but it still requires manually determining the selection, which is the part I'm trying to avoid. The solution from my OP using a composite mask for a visual takes fewer steps so is easier and faster way to get the visual for manual selection. Quote
David in Яuislip Posted Saturday at 12:29 PM Posted Saturday at 12:29 PM If you want to automate finding the max rectangle there is a useful Python solution here https://github.com/gusenov/max-empty-rect-py rect.py -i Lines.tif -o MaxRect.tif -f 0,255,0 -e 255,255,255 outputs (546309, [(179, 131, 779, 1039)]) takes 01m 18s Quote Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10
Stimutilated Posted Tuesday at 01:54 PM Author Posted Tuesday at 01:54 PM I looked at the readme from that project and the screenshot but I'm not following. The project didn't include any instructions or setup and I can't tell what the output actually is. Does it effectively just give you the coordinates of the corners? Can it somehow be incorporated into AP2 or is it standalone? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.