千家信息网

PHP图片处理库Grafika图像特效处理模块是什么

发表于:2025-11-16 作者:千家信息网编辑
千家信息网最后更新 2025年11月16日,今天就跟大家聊聊有关PHP图片处理库Grafika图像特效处理模块是什么,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。我们开门见山,直接继续上
千家信息网最后更新 2025年11月16日PHP图片处理库Grafika图像特效处理模块是什么

今天就跟大家聊聊有关PHP图片处理库Grafika图像特效处理模块是什么,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

我们开门见山,直接继续上实例,详细了解点击上面链接

图片过滤、滤镜

grafika提供了11种滤镜功能,可以满足开发中的任何情况需求。

这里先介绍一个操作方法:apply:它可以将滤镜效果应用到图片

图片模糊

使用Blur参数,模糊化一张图片

其中模糊度取值范围为0-100,数值越大,图片越模糊

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Blur', 50); // 模糊度为10,模糊度取值为0-100 $editor->apply( $image, $filter ); // 将滤镜应用到图片 $editor->save($image,'yanying-blur.jpg');

我们将图片模糊参数调为50

图片亮度调整

使用Brightness,加亮或者变暗图片

其中亮度值取值范围为

  • -100 至 -1,变暗

  • 0 图片没有变化

  • 1-100图片变量

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Brightness', -50); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Brightness-1.jpg');

改变图片颜色

使用Colorize参数,调整图片的红绿蓝三个基础色来改变图片颜色

颜色参数(红色、绿色、蓝色取值范围相同)

  • 取值-100至-1,颜色减少;

  • 如果为0表示不变;

  • 取值1-100,表示色值增加

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Colorize', -50,50,-50); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Colorize.jpg');

改变图片对比度

使用Contrast参数可以改变图片的对比度

对比度的取值和之前的也差不多,-100至-1,对比度减少;0不变;1至100,对比度增加

具体什么叫对比度,自行百度,我也不是太清楚,毕竟不是搞设计的

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Contrast', 50); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Contrast.jpg');

图像噪点

使用Dither来给图像添加噪点,其参数取值只有两个diffusion:扩散;ordered:规整的

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Dither', 'diffusion'); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Dither-diffusion.jpg');

图像色阶调整

Gamma这个参数在平时是不常用的,只有在专业的图像领域才会使用。可以理解为色阶,是灰阶亮度值与灰阶等级之间的数学关系。

这里的Gamma功能是校正图像色阶,使得图像看起来颜色更加正确

这里的数字值取值范围只有最小值没有***值只要 >=1.0都可以

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Gamma', 2.0); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Gamma.jpg');

图片灰度

使用Grayscale使图片所有的色彩丢弃,只保留黑白两种颜色,没有取值。

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Grayscale'); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Grayscale.jpg');

图像反色处理

图像反色,也就是弄得和胶片似得。

使用Invert参数可以达到图像反色效果,也没有可选值

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Invert'); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Invert.jpg');

图片像素化、栅格化

就是把矢量图形转换成像素点组成的点阵图形,也叫栅格化。搞ps的应该都清楚

该参数有个取值范围只要大于或者等于1就可以,如果值越大,像素点也就越大

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Pixelate',10); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Pixelate-10.jpg');

我们取值5和取值10对比下

图片锐化

图片锐化就是补偿图像的轮廓,增强图像的边缘及灰度跳变的部分,使图像变得清晰。

使用参数Sharpen可以处理锐化,其取值为1-100(包含)。

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Sharpen',50); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Sharpen.jpg');

我们取值50,看下效果

图像查找边缘

通过数学计算检测出图像的边缘,在ps中较为常用。

这里使用Sobel参数达到相同效果,没有值可选

use Grafika\Grafika; $editor = Grafika::createEditor(); $editor->open( $image, 'yanying-smaller.jpg' ); $filter = Grafika::createFilter('Sobel'); $editor->apply( $image, $filter ); $editor->save($image,'333/yanying-Sobel.jpg');

看完上述内容,你们对PHP图片处理库Grafika图像特效处理模块是什么有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。

图片 图像 参数 处理 对比度 颜色 范围 效果 滤镜 亮度 内容 只有 边缘 锐化 调整 模块 特效 相同 像素 功能 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 吉林通讯软件开发创意 软件开发助理都干啥 车站售票系统数据库分类 河北风景网络技术有限公司官网 北京思方远网络技术有限公司 csgo怎么切换服务器 涛思时序数据库 融资 上海造码网络技术有限公司主页 郑州网络安全防控 网络安全协议以什么为基础 数据库中any的作用 网络安全手抄报高中高难度 t6后台数据库名称及版本 一米无线深圳网络技术有限公司 以下哪些属于数据库技术 数据库实例监听启动不了 合耀(上海)网络技术 企业服务器自动关闭程序 网络安全培训福州 十堰好的软件开发多少钱 上海新世界网络技术有限公司 临汾天气预报软件开发 舟山网络安全课堂 省市县3级联数据库下载 学好软件开发要多久 vb如何打印数据库中的内容 东海口碑好的网络技术专业服务 创建sport数据库 上海洋码头网络技术有限公司公章 数据库备份提示错误23
0