ImageMagick Tips and Tricks



ImageMagick is a free software package for creating and editing raster graphics.
The features offered by ImageMagick range from combining multiple images, adding or creating simple shapes and fonts, distortions, resizing and rotating the images to filtering functions such as blurring, solarization, contrast adjustment, or inversion.

The user interface command (display) is not available under haiku due to the missing support of X11. There is a BeOS version of X11, which is however very old and would be hardly helpful here.

I will not give a complete description of ImageMagick here, but describe only individual functions. So not command line experienced users should be able to edit image files too.

All commands should also work with "mogrify". The difference is that convert requires a new file to be created and mogrify overwrites the original file.

 


 

Index
 
A


 
B


 
C


 
D


 
E


 
F


 
G


 
I


 
K


 
M


 
N


 
O


 
R


 
S


 
V


 
W

 


 

Adaptive blur

Adaptively blur pixels, with decreasing effect near edges.

convert -adaptive-blur radius x sigma /path/to/input/file /path/to/output/file


back to index


 

Adaptive sharpen

Adaptively sharpen pixels, with increasing effect near edges.

convert -adaptive-sharpen radius x sigma /path/to/input/file /path/to/output/file


back to index


 

Auto gamma

Automagically adjust gamma level of image.

convert -auto-gamma /path/to/input/file /path/to/output/file


back to index


 

Auto level

Automagically adjust color levels of image.

convert -auto-level /path/to/input/file /path/to/output/file


back to index


 

Auto orient

Adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).

convert -auto-orient /path/to/input/file /path/to/output/file


back to index


 

Blur

Blurs an image. Specify factor as the percent enhancement (0.0 - 99.9%).

convert -blur factor /path/to/input/file /path/to/output/file


back to index


 

Border

Surround the image with a border or color.

convert -border width x height /path/to/input/file /path/to/output/file


back to index


 

Charcoal

Simulate a charcoal drawing.

convert -charcoal factor /path/to/input/file /path/to/output/file


back to index


 

Colorize

Colorize the image with the pen color.

convert -colorize /path/to/input/file /path/to/output/file


back to index


 

Colorspace



Change colorspace of image to "type".

Type of colorspace: GRAY, HSL, OHTA, RGB, XYZ, YCbCr, YIQ, YPbPr, or YUV.

convert -colorspace type /path/to/input/file /path/to/output/file


back to index


 

Contrast

Enhance (+) or reduce (-) the image contrast.

convert -contrast /path/to/input/file /path/to/output/file
convert +contrast /path/to/input/file /path/to/output/file


back to index


 

Crop



Crop image to new size set by percent value.

convert -crop percent(%) /path/to/input/file /path/to/output/file
convert -contrast width(%) x height(%) /path/to/input/file /path/to/output/file


back to index


 

Cycle



Cycle the image colormap by "amount".

Amount defines the number of positions each colormap entry is shifted.

convert -cycle amount /path/to/input/file /path/to/output/file


back to index


 

Despeckle

Reduce the speckles within an image.

convert -despeckle /path/to/input/file /path/to/output/file


back to index


 

Edge

Detect edges within an image. Specify factor as the percent enhancement (0.0 - 99.9%).

convert -edge facor(%) /path/to/input/file /path/to/output/file


back to index


 

Emboss

Emboss, creating a metallic impression.

This operator tries to generate the effect of a acid impression of a grey-scale image on a sheet of metal.

convert -emboss /path/to/input/file /path/to/output/file


back to index


 

Enhance

Apply a digital filter to enhance a noisy image.

convert -enhance /path/to/input/file /path/to/output/file


back to index


 

Equalize



Perform histogram equalization to the image..

convert -equalize /path/to/input/file /path/to/output/file


back to index


 

Flip image horizontally



To flip a image horizontally we use the ImageMagick tool convert:

convert -flip /path/to/input/file /path/to/output/file


back to index


 

Flop image vertically



To flip a image vertically we use the ImageMagick tool convert:

convert -flop /path/to/input/file /path/to/output/file


back to index


 

Gaussian-Blur

Blur the image with a Gaussian operator by "radius" or "radius" x "sigma".

convert -gaussian-blur radius /path/to/input/file /path/to/output/file
convert -gaussian-blur radius x sigma /path/to/input/file /path/to/output/file


back to index


 

Implode



Implode image pixels about the center. Specify "factor" as the percent implosion (0 - 99.9%) or explosion (-99.9 - 0%).

convert -implode factor /path/to/input/file /path/to/output/file


back to index


 

Kuwahara

Edge preserving noise reduction filter.

The radius is more important than the sigma. If sigma is left off, it will be computed automatically from the radius as sigma=radius-0.5. The sigma provides a bit of additional smoothing control.

convert -kuwahara radius /path/to/input/file /path/to/output/file
convert -kuwahara radius x sigma /path/to/input/file /path/to/output/file


back to index


 

Mean-Shift

Image noise removal and color reduction/segmentation (e.g. -mean-shift 7x7+10%).

Width x Height is the window size and distance is the color distance measured in the range of 0 to 1 or 0 to 100%.

convert -mean-shift width x height + distance(%) /path/to/input/file /path/to/output/file


back to index


 

Median

Apply a median filter to the image. Select the "middle" value from all the surrounding pixels.

convert -median geometry /path/to/input/file /path/to/output/file


back to index


 

Modulate



Vary the "brightness", "saturation", and "hue" of an image.

Specify the percent change in brightness, the color saturation, and the hue separated by commas.

 

convert -modulate brightness,saturation,hue /path/to/input/file /path/to/output/file


back to index


 

Monochrome



Transform the image to black and white.

convert -monochrome /path/to/input/file /path/to/output/file


back to index


 

Motion-Blur

Blur an image by "radius", "sigma" and "angle"

Note that while "-radial-blur" blurs in both directions, "-motion-blur" only blurs in one direction.

 

convert -motion-blur radius x sigma + angle /path/to/input/file /path/to/output/file


back to index


 

Negate image file



To invert an image file we using the ImageMagick tool convert:

convert -negate /path/to/input/file /path/to/output/file


back to index


 

Normalize image colors



Transform image to span the full range of color values. This is a contrast enhancement technique.

convert -normalize /path/to/input/file /path/to/output/file


back to index


 

Ordered-Dither

Dither a image using a pre-defined ordered dither threshold map, and a uniform color map with the given number of levels per color channel.

threshold 1x1 Threshold 1x1 (non-dither)
checks 2x1 Checkerboard 2x1 (dither)
o2x2 2x2 Ordered 2x2 (dispersed)
o3x3 3x3 Ordered 3x3 (dispersed)
o4x4 4x4 Ordered 4x4 (dispersed)
o8x8 8x8 Ordered 8x8 (dispersed)
h3x4a 4x1 Halftone 4x4 (angled)
h6x6a 6x1 Halftone 6x6 (angled)
h8x8a 8x1 Halftone 8x8 (angled)
h3x4o   Halftone 4x4 (orthogonal)
h6x6o   Halftone 6x6 (orthogonal)
h8x8o   Halftone 8x8 (orthogonal)
h16x16o   Halftone 16x16 (orthogonal)
c5x5b c5x5 Circles 5x5 (black)
c5x5w   Circles 5x5 (white)
c6x6b c6x6 Circles 6x6 (black)
c6x6w   Circles 6x6 (white)
c7x7b c7x7 Circles 7x7 (black)
c7x7w   Circles 7x7 (white)

 

convert -ordered-dither threshold_map /path/to/input/file /path/to/output/file


back to index


 

Orient

Specify orientation of a digital camera image.

Choose from these orientations:

      bottom-left

 

      bottom-right

 

      left-bottom

 

      left-top

 

      right-bottom

 

      right-top

 

      top-left

 

      top-right

 

    undefined

 

convert -orient orientation /path/to/input/file /path/to/output/file


back to index


 

Solarize

Negate all pixels above the threshold level. Specify factor as the percent threshold of the intensity (0 - 99.9%).

convert -solarize factor x wavelength /path/to/input/file /path/to/output/file


back to index

 

Spread

Displace image pixels by a random amount.

convert -spread amount x wavelength /path/to/input/file /path/to/output/file


back to index

 

Swirl

Swirl pixels about the center. Degrees defines the tightness of the swirl.

convert -swirl degrees x wavelength /path/to/input/file /path/to/output/file


back to index

 

Rotate image file



To roate an image file we using the ImageMagick tool convert:

convert -rotate 90 /path/to/input/file /path/to/output/file


back to index

 

Vignette



A special operator to make a image circular with a soft blurry outline.

convert -vignette /path/to/input/file /path/to/output/file


back to index

 

Wave

Shear the columns of an image into a sine wave.

convert -wave amplitude x wavelength /path/to/input/file /path/to/output/file


back to index

 

Wavelet-Denoise

Removes noise from the image using a wavelet transform. With threshold you set up the noise itensity.

convert -wavelet-denoise threshold /path/to/input/file /path/to/output/file


back to index

Tutorials by Christian Albrecht (Lelldorin) June 2017
Made available by BeSly, the Haiku knowledge base