How to eliminate whitespace in a montage, then adjoin?
Posted: 2016-06-01T08:08:11-07:00
Greetings,
Running ImageMagick 6.9.4-3 Q16 armv7l 2016-05-21
Calling imagemagick using system call in PHP 7.0.7
Running Arch Linux armv7 version on Odroid C-1
On my website, I'm creating montages from user-submitted images of various aspect ratios. I'm only accepting 2 images at this point.
Imagemagick beautifully creates the montage. I'm going for common height to begin with, then a maximum width.
If I receive 2 images that have the exact same aspect ratio, the montage is perfect!
The problem I have not been able to figure out, after several hours of digging deep into the man pages, is how to remove the white space between a montage created from 2 images with dissimilar aspect ratios. When that happens I end up with something like the ascii graphic below.
The x'ed columns are the pictures I want to keep. The "Delete" column is the white space I would like to delete.
It feels like I need to use the "gravity" option but I just can't figure out how to pull it off.
Fred's "adjoin" script is close except I only have one picture to deal with and not 2.
I could probably get there if I could split the image down the middle, crop then adjoin but I can't depend on the middle being the best place to slice each time.
Fred's "splitcrop" in reverse would do the trick!
I've tried and failed. I now humbly submit my problem to the imagemagick wizards.
Thank you in advance.
~krb
Running ImageMagick 6.9.4-3 Q16 armv7l 2016-05-21
Calling imagemagick using system call in PHP 7.0.7
Running Arch Linux armv7 version on Odroid C-1
On my website, I'm creating montages from user-submitted images of various aspect ratios. I'm only accepting 2 images at this point.
Imagemagick beautifully creates the montage. I'm going for common height to begin with, then a maximum width.
If I receive 2 images that have the exact same aspect ratio, the montage is perfect!
The problem I have not been able to figure out, after several hours of digging deep into the man pages, is how to remove the white space between a montage created from 2 images with dissimilar aspect ratios. When that happens I end up with something like the ascii graphic below.
Code: Select all
---------------------------------------
| x | | x !
| x | | x !
| x | | x !
| x | Delete | x !
| x | | x !
| x | | x !
| x | | x !
---------------------------------------
It feels like I need to use the "gravity" option but I just can't figure out how to pull it off.
Fred's "adjoin" script is close except I only have one picture to deal with and not 2.
I could probably get there if I could split the image down the middle, crop then adjoin but I can't depend on the middle being the best place to slice each time.
Fred's "splitcrop" in reverse would do the trick!
I've tried and failed. I now humbly submit my problem to the imagemagick wizards.
Thank you in advance.
~krb