We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wrote this to add Image Convolution matrix options to an image though I would share. add this to \PHPImageWorkshop\Core\ImageWorkshopLayer.php
I put it just after apply Filter function.
public function applyImageConvolution($matrix, $div=0, $offset=0,$recursive=false){ if(is_string($matrix)){ $matrix = strtolower($matrix); switch($matrix){ case "blur": $matrix = array(array(1,1,1), array(1,.25,1), array(1,1,1)); $div = 8.25; $offset = 0; break;
case "emboss": $matrix = array(array(2, 2, 2), array(2, 1, -2), array(-2, -2, -2)); $div = 0; $offset = 127; break; case "gaussian blur" : $matrix = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0)); $div = 16; $offset = 0; break; case "sharpen" : $Matrix = array(array(-1.2, -1.2, -1.2),array(-1.2, .4, -1.2),array(-1.2, -1.2, -1.2)); $div = array_sum(array_map('array_sum', $Matrix)); $offset = 0; break; } } if(is_array($matrix)){ imageconvolution($this->image, $matrix, $div, $offset); } if ($recursive) { $layers = $this->layers; foreach($layers as $layerId => $layer) { $this->layers[$layerId]->applyImageConvolution($matrix, $div, $offset); } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I wrote this to add Image Convolution matrix options to an image though I would share.
add this to \PHPImageWorkshop\Core\ImageWorkshopLayer.php
I put it just after apply Filter function.
public function applyImageConvolution($matrix, $div=0, $offset=0,$recursive=false){
if(is_string($matrix)){
$matrix = strtolower($matrix);
switch($matrix){
case "blur":
$matrix = array(array(1,1,1), array(1,.25,1), array(1,1,1));
$div = 8.25;
$offset = 0;
break;
The text was updated successfully, but these errors were encountered: