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.

Comments

dopry’s picture

Status: Needs review » Needs work

Moonshine, 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.

Moonshine’s picture

Yep, 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.

dopry’s picture

php 5.1 is the very minimal version of php supported by image API.. I actually only officially support php 5.2.

Moonshine’s picture

StatusFileSize
new6.55 KB

Updated patch using unsharp mask technique for gd (- sigma).

Moonshine’s picture

Status: Needs work » Needs review
drewish’s picture

marked #266298: Unsharp masking... as a duplicate.

dopry’s picture

Status: Needs review » Fixed

committed to DRUPAL-5 and HEAD... untested.. I'm coming for you if it doesn't work moonshine :)

tnx...

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.