ImageMagick is a command line program for mangling pictures. It is called via magick
. It is very versatile and have a ton 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
-sample [x]%
-scale [x]%
-resize [x]%
-sample
command will have a much more distinct tesselation. -scale
and -resize
tend to get more blurry.
-rotate [degree]
-shear [val]x[val]
-swirl [degree]
-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 otherName | 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) |
thresholds.xml
that you can find by using
<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>
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
15.9999
, here it is for a 16 frame gif
black
which use black (duh) or tile
which repeat the image
For more info check the Virtual Pixel Documentation.
To extract a palette from an image, you can use the code below, you can find a palette script here, with all my bash utilities.
# speed up process by reducing image size magick $INPUT -sample 10% temp.png # find all the colors COLOR_LIST=`magick temp.png -format %c -colorspace LAB -colors $COLORS histogram:info:-` # format the list text FORMATTED_LIST=`echo $COLOR_LIST | sort -n -r | tr ' ' '\n' | sed -n '/^srgb/p' | tr ' ' '\r'` rm temp.png # generate an array with the colors to be used in next command images=() for ((i=1; i<=COLORS; i++)); do color=$(echo "$FORMATTED_LIST" | sed -n "${i-1}p") images+=("xc:\"$color\"") done # create picture where each pixel is one of the colors eval magick -size 60x60 "${images[@]}" +append $OUTPUT
Then you can call this command to apply the palette to any image.
magick input.png -remap palette.png output.png