
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
imageconvolution() function in PHP
The imageconvolution() function
Syntax
bool imageconvolution (img, matrix, div, offset )
Parameters
img: Create image with imagecreatetruecolor() function.
matrix: A 3x3 matrix is an array of three arrays of three floats.
div: Divisor of the result of the convolution, used for normalization.
offset: The color offset.
Return
The imageconvolution() function returns True on success or False on failure.
Example
The following is an example
<?php $img = imagecreatefromgif('https://www.tutorialspoint.com/images/html.gif'); $arr = array(array(2, 0, 1), array(-1, -1, 0), array(0, 0, -1)); imageconvolution($img, $arr, 1, 127); header('Content-Type: image/png'); imagepng($img, null, 9); ?>
Output
The following is the output
Example
Let us see another example with different parameter values for the same image. You can easily spot the difference now:
<?php $img = imagecreatefromgif('https://www.tutorialspoint.com/images/html.gif'); $arr = array(array(3, 2, 1), array(0, 1, 0), array(1, -1, -1)); imageconvolution($img, $arr, 3, 110); header('Content-Type: image/png'); imagepng($img, null, 9); ?>
Output
The following is the output
- Related Articles
- How to apply a 3×3 convolution matrix using imageconvolution() in PHP?
- filter_has_var() function in PHP
- filter_id() function in PHP
- filter_input() function in PHP
- filter_input_array() function in PHP
- filter_list() function in PHP
- filter_var_array() function in PHP
- filter_var() function in PHP
- constant() function in PHP
- define() function in PHP
- defined() function in PHP
- die() function in PHP
- eval() function in PHP
- exit() function in PHP
- get_browser() function in PHP

Advertisements