Page 1 of 1
Montage and the crop the output in one command?
Posted: 2019-02-18T01:24:29-07:00
by mhulse
Hello,
I have a set of tiles that I am using montage to create an equirectangular image using IM/montage/bash.
The resulting image output of the montage command needs to be cropped.
I've tried variations of:
Code: Select all
montage \
+frame \
+shadow \
-quality 100 \
-tile 5x3 \
-geometry 512x512+0+0 \
-crop 2508x1254+0+0 \
"$currentDir/tile_*.jpg" \
"$currentDir.jpg"
What would be the most optimal way to crop the resulting montaged image?
Basically, I'm just wanting to avoid creating multiple JPGs ... Could I use bash's pipe (I tried this but I was not sure how to get montage into convert using pipe).
Any tips/help would be great.
Re: Montage and the crop the output in one command?
Posted: 2019-02-18T10:42:27-07:00
by fmw42
Pipe your montage output to a new magick command that will crop the result and make a new output.
Something like
Code: Select all
montage \
+frame \
+shadow \
-quality 100 \
-tile 5x3 \
-geometry 512x512+0+0 \
"$currentDir/tile_*.jpg" \
miff:- | magick - "$currentDir.jpg"
Re: Montage and the crop the output in one command?
Posted: 2019-02-18T10:45:54-07:00
by snibgo
As Fred says, and the "convert" can do whatever cropping or other processing is required. However as IM v7 is used, I suggest "magick montage" and "magick" instead of "montage" and "convert".
Re: Montage and the crop the output in one command?
Posted: 2019-02-18T10:46:48-07:00
by fmw42
Thanks, snibgo. Too used to using convert. I have corrected my post.
Re: Montage and the crop the output in one command?
Posted: 2019-02-18T10:53:30-07:00
by mhulse
Thanks Fred and snibgo!!!! I greatly appreciate the assistance!
It's been about a year since I last used IM on the regular... I didn't realize there was a new command name! That's cool! I need to read up on the changes since I last used IM.
Thanks again!!!!
Re: Montage and the crop the output in one command?
Posted: 2019-02-18T11:29:36-07:00
by fmw42
see
https://imagemagick.org/script/porting.php#cli
Note for other tools such as montage, mogrify, identify, you do need to preface those with magick. Just not convert.
Re: Montage and the crop the output in one command?
Posted: 2019-02-18T12:20:02-07:00
by mhulse
Thank you so much for the help! I love ImageMagick. Not only is the tool itself amazing, but people like you and snibgo make it so much more approachable to users like me.
With that said, I'll post back my exact command once I get it finalized, just in case seeing my particular use case will help others in the future.
Have an excellent day!
Re: Montage and the crop the output in one command?
Posted: 2019-02-19T22:34:44-07:00
by mhulse
Thanks again for the help snibgo and Fred, it's much appreciated.
Here's what I'm using to combine and crop:
Code: Select all
magick \
montage \
+frame \
+shadow \
-tile 5x3 \
-geometry 512x512+0+0 \
"$currentDir/tile_*.jpg" \
+depth \
miff:- \
| \
magick \
- \
-quality 100 \
-crop 2508x1254+0+0 \
"$currentDir.jpg"
I ended up moving the quality to the right side of the pipe ... Based on docs, it sounds like miff: and +depth already use the highest res possible.
ImageMagick rocks!