图像处理库 gd_使用PHP和GD库进行图像处理

图像处理库 gd

David Walsh Sepia

Yeah, I'm a Photoshop wizard. I rock the selection tool. I crop like a farmer. I dominate the bucket tool. Hell, I even went as far as wielding the wizard wand selection tool once.

是的,我是Photoshop向导。 我摇摆选择工具。 我像农夫一样种庄稼。 我主导了存储桶工具。 地狱,我什至甚至挥舞过一次魔杖选择工具。

...OK I'm rubbish when it comes to Photoshop. I avoid opening the memory pig whenever possible. Many times I even need to automate image manipulation on customer websites. Luckily for a nerd like me, PHP's GD library allows me to systematically execute basic image manipulations without the need for Photoshop, GIMP, or other desktop tools.

...好,关于Photoshop,我很垃圾。 我避免尽可能打开内存管。 很多时候,我什至需要在客户网站上自动化图像处理。 幸运的是,对于像我这样的书呆子,PHP的GD库使我可以系统地执行基本的图像操作,而无需使用Photoshop,GIMP或其他桌面工具。

PHP-颜色从灰度 (The PHP -- Color to Greyscale)


//to black and white
if(!file_exists('dw-bw.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_GRAYSCALE);
	imagepng($img,'db-bw.png');
	imagedestroy($img);
}


PHP-颜色变为负数 (The PHP -- Color to Negative)


//to negative
if(!file_exists('dw-negative.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_NEGATE);
	imagepng($img,'db-negative.png');
	imagedestroy($img);
}


PHP-棕褐色的颜色 (The PHP -- Color to Sepia)


//to black and white, then sepia
if(!file_exists('dw-sepia.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_GRAYSCALE);
	imagefilter($img,IMG_FILTER_COLORIZE,100,50,0);
	imagepng($img,'db-sepia.png');
	imagedestroy($img);
}


As you can see, PHP's GD library is a very competent, useful library. Though image libraries like ImageMagick get more credit than GD, GD is more than enough for the majority of designers and developers. Be sure to check out PHP image filters -- you can emboss images, fade images, and much more!

如您所见,PHP的GD库是一个非常有用的有用的库。 尽管像ImageMagick这样的图像库比GD获得更多的信誉,但是GD对于大多数设计人员和开发人员来说绰绰有余。 一定要检查PHP图像过滤器 -您可以压印图像,淡化图像等等!

翻译自: https://davidwalsh.name/php-image-filter

图像处理库 gd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值