打开GIF图像,增加“画布”按 100 像素
嘿,我想使用 PHP 的 GD 库打开 GIF 图像并将画布的高度增加 100 像素,然后用十六进制颜色 #EEEEEE 填充新空间。
有谁知道我会怎么做?
Hay, I want to use PHP's GD library to open a GIF image and increase the canvas's height by 100 pixels, then fill the new space with the hex colour #EEEEEE.
Does anyone have any idea how i would do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
getimagesize
获取原始尺寸imagecreate
创建“新”图像所需的尺寸#eeeeee
填充新图像code>imagecolorallocate(参见注释)imagecopy
将原始图像复制到新图像中getimagesize
imagecreate
to create your "new" image with the desired size#eeeeee
usingimagecolorallocate
(see note)imagecopy
to copy your original image into the new one如果您的问题是“有人知道我会怎么做吗?”那么答案是肯定的。很可能有人知道如何做到这一点。 :)
否则这应该可以解决问题:
If your question is "Does anyone have any idea how i would do this?" Then the answer is yes. Most probably someone have an idea how you could do it. :)
Otherwise this should do the trick: