将两个图像合并到服务器上,然后保存 [英] Merge Two images together on Server, then save

查看:89
本文介绍了将两个图像合并到服务器上,然后保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是php的新手,但我相当确定这是可以做到的.我的服务器上有一堆图像,我想给它们全部加粗的黑色边框.我知道我可以使用CSS,但我宁愿边框是真实的.我的图像大小都是相同的,因此无非就是将服务器图像居中放置在该黑盒图像上,然后将它们合并在一起并重新保存服务器图像.

I'm new to php, but i'm fairly certain this is possible to do. I have a bunch of images on my server, and i'd like to give them all a thick black border. I know i could use CSS, but i'd rather the border was real. My images are all the same size, so it's nothing more than centering the server image onto this black box image, then merging them together and re-saving the server image.

从技术上讲,我也可以在photoshop中做到这一点,但是有很多图像……

I could technically do this in photoshop too, but there's a ton of images...

奖金

如果我可以在完成后缩小图像,那也很好.它们比我需要的大一点.

If i could shrink the image after i'm done, that'd be nice too. They are a bit larger than i need.

推荐答案

看看imagemagick,在这里查看一些示例 http://www.imagemagick.org/script/examples.php

Take a look at imagemagicks, see some examples here http://www.imagemagick.org/script/examples.php

您可以通过PHP中的exec()调用它

You can call it via exec() from PHP

例如将两个图像彼此对齐,并在每个图像周围添加边框:

e.g. aligning two images next to each other, adding a border around each of them:

$cmd = 'montage image1.jpg image2.jpg -tile x1  -border 5 -geometry +5+5   result.jpg';
exec($cmd);

这篇关于将两个图像合并到服务器上,然后保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆