Composite portrait image over blur version of same image
Posted: 2019-03-25T11:32:12-07:00
Using ImageMagick 6.9.6-6 Q16 x86_64 2016-12-24, I'm trying to make photos shot with portrait orientation appropriate for TV by superimposing each image over wider, blurred copies of the same image. I'm running on macOS 10.12.6 (Sierra) on a 2012 iMac. I've written a shell script to perform this operation upon every image in a directory. For some images, the script does what is expected, but for other images the results are incorrect.
Here is a link to a folder in my Dropbox: https://www.dropbox.com/sh/1o7i91bt4v9x ... wFala?dl=0. Photo 1-Flowers.png is an original photo in portrait orientation. Photo 2-Flowers-blur.png shows the result created by my shell script. The script placed enlarged, blurred copies of the original photo on the left and right sides, so that the resulting composite photo is now in landscape orientation.
Photo 3-Lab.jpg is another original portrait-oriented photo, and Photo 4-Lab-blur.jpg shows the result created by my shell script. Rather than placing the enlarged, blurred copies on the sides, the shell script placed these copies above and below the original.
Here is my shell script:
I would appreciate any assistance with understanding why this script behaves as it does, and how to modify it so that it performs reliably on every portrait-oriented image.
Thanks,
FastBill
Here is a link to a folder in my Dropbox: https://www.dropbox.com/sh/1o7i91bt4v9x ... wFala?dl=0. Photo 1-Flowers.png is an original photo in portrait orientation. Photo 2-Flowers-blur.png shows the result created by my shell script. The script placed enlarged, blurred copies of the original photo on the left and right sides, so that the resulting composite photo is now in landscape orientation.
Photo 3-Lab.jpg is another original portrait-oriented photo, and Photo 4-Lab-blur.jpg shows the result created by my shell script. Rather than placing the enlarged, blurred copies on the sides, the shell script placed these copies above and below the original.
Here is my shell script:
Code: Select all
#!/bin/sh
for f in ./*.*
do
echo $f
convert "$f" \( -clone 0 -resize 200% -blur 0x37 -gravity center -crop x50%+0+0 +repage \) \( -clone 0 \) -delete 0 -gravity center -compose over -composite -set filename:fname %t_blur.%e ../_originals/%[filename:fname]
done
Thanks,
FastBill