Large image processing problems..

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

The -fx option is reparsed for each pixel which makes it prohibitively slow for large images. It was designed to conveniently experiment with new algorithms, not for production runs. Once a new algorithm is tested with -fx, it should be converted to an ImageMagick filter for production use. Filters are invoked with the -process option. We have one example in the ImageMagick source distribution in the ImageMagick/filters folder called analyze.c. If you write a custom filter that you think others might find useful you can post it in the User forum and if it is of general usefulness we might move it to the ImageMagick distribution (if you release it under the ImageMagick license).

If the problem you are having is something other than slow processing, try ImageMagick 6.2.7-2, the latest release. If it fails as well, repost with exactly what the problem is and we will investigate further.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

In the next point release we'll add an -adaptive-sharpen option that should perform the sharpening effect your describe. It will be relatively fast since it will not be interpretted like -fx is.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

The new -adaptive-sharpen option will be available tommorrow as ImageMagick 6.2.7-3 Beta here: ftp://ftp.imagemagick.org/pub/ImageMagick/beta. You will find the algorithm as AdaptiveSharpenImage() in magick/effects.c and you can invoke it like this:
  • convert before.png -adaptive-sharpen 0x1 after.png
Currently we do everything in the RGB colorspace so we can sharpen CMYK images. The original article suggested the luminosity channel of the HSV colorspace. If you want to experiment, use
  • SetImageColorspace(edge_image,HSBColorspace);
to convert to hue, saturation, and brightness and the blue channel contains the brightness channel. To convert it back to RGB, use
  • SetImageColorspace(sharp_image,RGBColorspace);
If someone comes up with changes that produce better results, post the patches here and we will get them into the main ImageMagick distribution.
donproc
Posts: 1
Joined: 2012-02-06T01:17:39-07:00
Authentication code: 8675308

Re: Large image processing problems..

Post by donproc »

hi, magick

would you please tell me which article described the algorithm of adaptive sharpen used in ImageMagicK.

Thanks,
donpro
tcrass
Posts: 38
Joined: 2009-11-22T11:12:52-07:00
Authentication code: 8675309

Re: Large image processing problems..

Post by tcrass »

Hi there,
donproc wrote:hi, magick
would you please tell me which article described the algorithm of adaptive sharpen used in ImageMagicK.
I second! Any information available about the implemented algorithm? (I tried to have a look at the source code, but for someone not deeply involved in ImageMagick memory management, it is virtually impossible to figure out what the AdaptiveShaprenImage function actually does to the image...)

Cheers --

-- Torsten
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Large image processing problems..

Post by magick »

The algorithm is described as "adaptively sharpens the image by sharpening more intensely near image edges and less intensely far from edges. We sharpen the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma." The algorithm creates a set of kernels with linearly increasing "sharpiness" and picks one based on the edge gradient. If its a flat area, its sharpened less intensely to preserve the original fidelity of the pixels. If its near an edge, its sharpened more intensely.
Post Reply