Combine 2 images side by side into 1 with ImageMagick (PHP)

后端 未结 4 1673
清酒与你
清酒与你 2021-02-08 09:28

I think this is an easy one.

I have 2 Pictures/JPGs and i want them to merge into one picture where the 2 are side by side.

So i have pic [A] and pic [B] and I w

4条回答
  •  一个人的身影
    2021-02-08 10:07

    No need to use -geometry if both files are the same size. Try

    exec($IMAGEMAGICK_PATH."convert picA.jpg picB.jpg +append picAB.jpg");
    

    Use -append if you want to merge pictures in a column.

    Add -background none or -background black or -background white or whatever, if your pictures are not the same size. In this case you may also want to add -gravity center or -gravity south or some such to control how exactly the two images merge. The -gravity needs to appear before the +-append on the commandline then:

    exec($IMAGEMAGICK_PATH."convert big.jpg small.jpg -gravity east -append 2x.jpg");
    

提交回复
热议问题