note 56144 deleted from ref.image by cmb
| From: | cmb@php.net | Date: | Thu, 13 Oct 2016 17:34:38 +0000 |
| Subject: | note 56144 deleted from ref.image by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206885@lists.php.net to get a copy of this message | ||
Note Submitter: timeshifting at gmail dot com
----
To sharpen an image, rather than using the code below that produces a sharpening filter with php,
use the built-in GD function "imageconvolution" which is designed for this purpose.
Matrices can be used for sharpening, blurring, edge detection, etc, ala Photoshop.
A sharpening example:
<?php
$sharpenMatrix = array(-1,-1,-1,-1,16,-1,-1,-1,-1);
$divisor = 8;
$offset = 0;
imageconvolution($myImage, $sharpenMatrix, $divisor, $offset);
?>
Below is some information on building different kinds of matrices. (If you have photoshop (or PSP,
GIMP) you can test out your matrices before applying them in PHP)
http://loriweb.pair.com/8udf-basics.html
(covers blurs)
http://loriweb.pair.com/8udf-sharpen.html
http://loriweb.pair.com/8udf-edges.html
http://loriweb.pair.com/8udf-emboss.html