Created
June 5, 2012 03:48
-
-
Save mateuslopes/2872512 to your computer and use it in GitHub Desktop.
PHP+Image: Image Better Quality Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$img_r = imagecreatefromjpeg($src); | |
imagefilter($img_r, IMG_FILTER_BRIGHTNESS, 5); | |
imagefilter($img_r, IMG_FILTER_CONTRAST, -10); | |
$sharpenMatrix = array | |
( | |
array(-2, -1, -2), | |
array(-1, 40, -1), | |
array(-2, -1, -2) | |
); | |
// calculate the sharpen divisor | |
$divisor = array_sum(array_map('array_sum', $sharpenMatrix)); | |
$offset = 0; | |
if($w < 1200){ | |
// apply the matrix | |
imageconvolution($img_r, $sharpenMatrix, $divisor, $offset); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment