Here is a patch to add sharpening functions to ImageAPI. Both GD and Imagemagick are covered although GD just falls back to a simple convolution matrix as noted throughout. I will open an Imagecache issue for the patch that includes the sharpening action.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | imageapi-sharpening-v2.patch | 6.55 KB | Moonshine |
| imageapi-sharpening-v1.patch | 2.73 KB | Moonshine |
Comments
Comment #1
dopry commentedMoonshine, you're actually implementing an 'unsharp mask' with imagemagick and it can be done in php for GD.... see http://vikjavev.no/computing/ump.php...
the only thing missing from the reference implementation that imagemagick has is sigma... The sigma is used in the building of the gaussian matrix... see: http://en.wikipedia.org/wiki/Gaussian_blur
I would like both toolkits to be as functionally identical as possible. I don't know how to compute the gaussian matrix and don't have time to grok it at the moment, but I would accept and updates patch with sigma fixed for imagemagick until it can be properly implemented in GD as well.
Comment #2
Moonshine commentedYep, it's an unsharp mask. Although I think it's still best for the action to refer to itself as a "Sharpen(ing)" action as unsharp still confuses many...
After quickly glacing at that link, it also looks like there will have to be alternate GD code for php < 5.1, as it doesn't have imageconvolve(). :/ Either way, I'll take a peek in the next few days and try to merge that technique in there.
Comment #3
dopry commentedphp 5.1 is the very minimal version of php supported by image API.. I actually only officially support php 5.2.
Comment #4
Moonshine commentedUpdated patch using unsharp mask technique for gd (- sigma).
Comment #5
Moonshine commentedComment #6
drewish commentedmarked #266298: Unsharp masking... as a duplicate.
Comment #7
dopry commentedcommitted to DRUPAL-5 and HEAD... untested.. I'm coming for you if it doesn't work moonshine :)
tnx...
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.