Long story short from the command line I need to take a screenshot, crop two areas of that screenshot and join them back together side-by-side.
The separate stages which work fine look like this:
$> import -window root -crop '1280x400+0+0' left.png
$> import -window root -crop '1280x400+0+400' right.png
$> montage -geometry 1280x400 left.png right.png out.png
However, I'm not sure how to combine this into one command.
OS is Linux (Raspbian) if that helps.
I'm not sure how to do any cropping as part of a
magick import
so I'll import and forward to a regularmagick
command for processing.To mimic your approach, that would be:
That first grabs the screen with
import
and pipes it on as a PNG to a second command that clones the image and crops the left half, clones it again and crops the right half, deletes the original and places the two crops side-by-side.There is an easier way that works for you though. If you crop without an offset, all the cropped areas will remain in your stack:
Note: I am also using 50% of the height as the crop to save me having to do any maths
Note: If you want a magenta gap between the two halves, add
-background magenta
near the start and replace+append
with+smush 10
to place them 10 pixels apart.