ImageMagick is a command line program for mangling pictures. It is called via magick
. It is very versatile and have a tons of flags and options.
On this page you'll find some useful or interesting technics, you can find experimentations on this project page.
[x]
indicate a value to be modified
Table of Content
Basics
Size
-sample [x]%
-scale [x]%
-resize [x]%
The -sample
command will have a much more distinct tesselation. -scale
and -resize
tend to get more blurry.
Documentation about warping
-rotate [degree]
-shear [val]x[val]
-swirl [degree]
Other Useful Things
-alpha off
: Deactivate the transparency layer
-threshold [x]%
: Basic black and white by comparison
-quality [value]
: Value between 0
and 10
-edge [thikness]
: Keep only the edges of the image
-blur [radius]x[sigma]
: For the calculation of a pixel, radius
determine the area around that is involved, sigma
the amount of contribution
-modulate [hue]x[sat]x[lightness]
: HSL modulation, 100 = no modification
+level-colors [replace black with],[replace white with]
: easy manipulation of colors. List of all imagemagick colors can be found on this webpage
magick in.source out.destination
: convert from any format to any other
Dithering
Error Diffusion
-dither FloydSteinberg or Riemersa -colors [number of colors]
It seems that the colors reduction must take place after the dithering for it to work
Reducing size will lead to more obvious patterns and overall a more typical lo-fi dithering look.
Ordered Dithering
-ordered-dither [map]
Lists of maps :
Name |
Alias |
Description |
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) |
h4x4a |
4x1 |
Halftone 4x4 (angled) |
h6x6a |
6x1 |
Halftone 6x6 (angled) |
h8x8a |
8x1 |
Halftone 8x8 (angled) |
h4x4o |
|
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) |
Adding maps
All maps are stored in a file named thresholds.xml
that you can find by using
magick identify -list threshold
Here is an example of map that you can append to the file (it creates a diagonal dithering):
<threshold map="diag5x5" alias="diag">
<description>Simple Diagonal Line Dither</description>
<levels width="5" height="5" divisor="6">
4 2 1 3 5
2 1 3 5 4
1 3 5 4 2
3 5 4 2 1
5 4 2 1 3
</levels>
</threshold>
Using Pictures as map
Each frame of gif will be used for a level of luminosity. This can be used to make ASCII version of a picture.
- Collect multiple pictures in a gif: (example with jpg)
magick *.jpg out.gif
(you may also add -scale [x]x[y]
to be sure that all image will be the same size (and squared))
-
magick input.png -alpha off -colorspace sRGB -grayscale Average \
-scale 1600% -negate \
symbols.gif -virtual-pixel tile -fx 'u[floor(15.9999*u)+1]'\
output.png
Adjust 15.9999
, here it is for a 16 frame gif
Note on Virtual Pixels
Virtual Pixels aim to ease edge processing for algorithm requiering pixel's neighboors for computation. It got various method to define those "virtual pixels" outside of the image, such as
black
which use black (duh) or
tile
which repeat the image
Virtual Pixel Documentation.
References