Looks like it uses the image itself to set up a 'internal squaring' however it relies on trim to do the task.stupid wrote:I'm not sure this is what you're after but....
Select the section of your image with the -gravity setting after Src.
Code: Select all
convert INPUT.JPG -write mpr:0 / -gamma -1 / ( mpr:0 -gamma 0 ( +clone -gamma -1 -rotate 90 ) -compose Over -composite -bordercolor BLACK -border 1 -trim +repage mpr:0 -compose Src -gravity East -composite ) / -compose Copy -gravity Center -composite / OUTPUT.JPG
Reposition your image on the background canvas with the -gravity setting after Copy.
- save original image.
- make white version (for later)
- make black version.
- make rotated white version.
- Overlay that on black (composite trims)
- then use trim to remove any black still remaining to get 'internal square'
- overlay (with Src compose) the original (composite trims) using gravity to select what part of image,
- overlay on white
Still it is a novel use of composite and trim to create an internal square crop, and uses pure white and black images for this process to avoid any dependancy on colors within the input image. Though it also requires a lot of processing steps to achive the goal.
What is amazing is that this would work with extrememly old versions of IMv6, long before the 'distort' operator was added.