How to Sharpen Blurry Images with ImageMagick?

ImageMagick is a powerful command-line tool that can quickly restore clarity to soft or blurry photographs. By utilizing the convert command alongside specific image processing operators like -sharpen and -unsharp, you can enhance edge contrast and bring out hidden details in your digital images. This guide will walk you through the essential commands, syntax, and advanced techniques required to effectively sharpen your photos directly from the terminal.

The Basic Sharpen Command

The most straightforward way to fix a soft image in ImageMagick is by using the -sharpen operator. This built-in function applies a Gaussian enhancement filter to the image to increase the contrast along the edges.

The basic syntax requires two parameters: radius and sigma.

magick convert input.jpg -sharpen radiusxsigma output.jpg

For a standard, quick enhancement, you can run:

magick convert blurry_photo.jpg -sharpen 0x1.5 sharpened_photo.jpg

The Advanced Unsharp Mask Command

While the basic sharpen command works well, professional image editors usually prefer the -unsharp operator. Despite its counterintuitive name, an unsharp mask is the gold standard for digital sharpening because it offers much greater control over the final look, preventing the image from looking overly pixelated or digital.

The unsharp mask syntax takes four distinct parameters:

magick convert input.jpg -unsharp radiusxsigma+amount+threshold output.jpg

An effective command for a noticeably blurry photo would look like this:

magick convert blurry_photo.jpg -unsharp 0x1.5+1.2+0.02 sharpened_photo.jpg

Tips for Best Results

When using ImageMagick to fix blurry photos, keep these best practices in mind to avoid introducing ugly artifacts or digital noise to your images: