ImageMagick can only process once the file is uploaded. I am not sure what you want for the result.
- upload a 4/3 aspect ratio image
- create a blur version of it
- split that blur version in 2 vertically and spread it on both sides of the upload image to change its aspect ratio ratio to 3/2
So if you upload a 400x300 pixel image you end up with a 450x300 pixel size image where both sides have a blur version of each side "underneath it".
So you start with a 400x300 (WxH) image. If you blur it, it is still only 400x300. If you resize the input to 450x300, then it is wider than before and perhaps you want to split the image in left and right sides; otherwise, there is no point is splitting the top and bottom, since the height has not changed?
Input (400x300):
So which do you want?
Code: Select all
convert barn2.png \
\( -clone 0 -resize 450x300! -blur 0x3 \) \
\( -clone 0 -crop 100x50% +repage \) \
\( -clone 1 -clone 2 -gravity north -compose over -composite \
-clone 3 -gravity south -compose over -composite \) \
-delete 0-3 barn2_comp1.png
In the above case, there is really no point in splitting the resized image. It just needs to be inserted into the center of the blurred image as follows:
Code: Select all
convert barn2.png \
\( -clone 0 -resize 450x300! -blur 0x3 \) \
+swap -gravity center -compose over -composite \
barn2_comp1b.png
The result should be the same as the previous code.
Or do you want:
Code: Select all
convert barn2.png \
\( -clone 0 -resize 450x300! -blur 0x3 \) \
\( -clone 0 -crop 50x100% +repage \) \
\( -clone 1 -clone 2 -gravity west -compose over -composite \
-clone 3 -gravity east -compose over -composite \) \
-delete 0-3 barn2_comp2.png
If I have misunderstood, please clarify.
Please see
viewtopic.php?f=1&t=9620
ImageMagick can
1) resize an image -- see
http://www.imagemagick.org/Usage/resize/
2) split into two parts -- see
http://www.imagemagick.org/Usage/crop/#crop
3) composite each part over some background image -- see
http://www.imagemagick.org/Usage/compose/#compose and
http://www.imagemagick.org/Usage/layers/#convert
If you can provide and example or drawing of what you want and and explanation, then we can provide the specific code to help you do that.
Please provide your platform/OS since ImageMagick code may be OS dependent and if you have installed ImageMagick, then what version you. are using.