Below are some cool techniques and applications I use or find
interesting to do out of the ordinary things. Most of these techniques can be accomplished in
various ways. This page is just a primer really, read the man
pages for each program.
Artistic Photo Processing
Create a visual image directory (thumbnail card) of all images in a directory:
$ gm convert 'vid:*.jpg' directory.jpg
or
$ gm convert 'vid:*.jpg' directory.miff
To view .miff files:
$ gm display directory.miff
Create a charcoal drawing from a photo:
$ gm convert -charcoal FACTOR INPUT.xxx OUTPUT.xxx
or
$ gm mogrify -charcoal FACTOR FILE.xxx
or
$ convert INPUT.xxx -charcoal 5 OUTPUT.png
Create a colored-in outline image from a photo:
$ convert INPUT.xxx -colorspace gray \( +clone -blur 0x2 \) +swap
-compose divide -composite -linear-stretch 5%x0% OUTPUT.png
Create a pencil sketch from a photo:
$ convert INPUT.xxx -colorspace gray -sketch 0x20+120 OUTPUT.gif
Create an oil painting from a photo:
$ gm convert -paint 7 INPUT.xxx OUTPUT.xxx
Create an Embossed image from a photo:
use emboss script
$ ./emboss -m 1 -d 7 INPUT.xxx OUTPUT.xxx
Texturize a photo:
(this method requires an external texture file, INPUT.xxx)
$ composite texture_file.gif INPUT.xxx -tile -compose Hardlight OUTPUT.jpg
Make a photo look like a Cartoon/Comic output:
use cartoon script
$ ./cartoon INPUT.xxx OUTPUT.xxx
ASCII/ANSI Art utilities
jp2a CLI tool (image to ASCII/ANSI)
$ jp2a --size=320x240 input.jpg --output=output_ascii.txt
or
$ jp2a --width=320 --color --html --fill --background=light input.jpg --output=output.html
caca-utils package (image to ANSI)
$ img2txt -W 480 -f tga ./input.jpg > output_ansi.tga
cacaview (views images using ascii, only good for small resolution images like icons)
nfoview (NFO viewer that handles the ascii art code page properly)
python-aafigure (converts ascii to png or svg, works better with the ascii generated from GAAT):
$ aafigure input_ascii -t png -o output.png
acidview (need to run under Wine, for viewing animated ANSI)
Anyone know of a native Linux software that can view animated ANSI art files (and I mean a program that acutally shows the animations)?
PabloDraw This is acutally a "native Linux" via Mono
application that can view animated ANSI. It also requires a very
new version of Mono which rules out a lot of Debian distros, but works
fine on my Slackware box.
a3b (ascii art viewer)
tetradraw/tetraview (ANSI art drawing and viewing)
ansi2gif Creates animated GIFs from animated or blinking ANSI art. Very cool! Some examples of usage:
$ ./ansi2gif --gif --ysize auto INPUT.ANS OUTPUT.GIF
$ ./ansi2gif --animate --timedelay 2 --gif --ysize auto INPUT.ANS OUTPUT.GIF
$ ./ansi2gif --blink --gif INPUT.ANS OUTPUT.GIF
Animated GIFs from Videos
Here are some methods for producing animated GIF from video/movie
files. In contrast to other webpages or blog posts you'll find if
you search on this topic, these two methods actually work with
contemporary ffmpeg and ImageMagick as of the year 2012.
Method 1 (basic method):
Specify an input file, the time to start (-ss), the duration in seconds (-t), and how many fps (-r).
$ ffmpeg -i INPUT.mp4 -r 10 -ss 00:14:31 -t 00:00:10 /home/user/temp/output%05d.png
$ convert /home/user/temp/output*.png /home/user/temp/output.gif
Optimize the output, some of these options may be redundant depending on the input file:
$ gifsicle --delay=50 --loop --optimize=2 --colors=256 --multifile /home/user/temp/output.gif > /home/user/temp/final_output.gif
Method 2 (produces smaller more refined GIFs),
original source here:
Specify an input file, the time to start (-ss), how many fps (-r), and the total amount of frames (-vframes).
$ ffmpeg -ss 00:12:30 -i INPUT -r 8 -vframes 32 -vbsf remove_extra -an -vcodec pam -f rawvideo -y /home/user/temp/anim.pam
Adjust the
-resize to your specific needs.
$ convert /home/user/temp/anim.pam -depth 32 -colorspace YCC -resize 300x169! -colorspace Lab -identify /home/user/temp/anim.miff
Use the output of the next command in order to adjust the dither levels
and threshold pattern try to hit 255 colors on the output. The bare
minimum dither should be 15,11,11. That gives 15 levels of luminance
and 11*11=121 different colors, plus the dithering itself which fakes
other hues. AB levels from 11 to 13 are best.
$ convert /home/user/temp/anim.miff -ordered-dither o8x8,15,11,11 -depth 8 -colorspace sRGB -append -format %k info:
Final conversion command, adjust
-ordered-dither o8x8,25,12,12 to the values you determined hit 255 colors in the previous step:
$ convert /home/user/temp/anim.miff
-ordered-dither o8x8,25,12,12 -depth 8 -colorspace sRGB +dither +remap
-coalesce -deconstruct -layers RemoveDups -layers Optimize -delay 1x9
-identify/home/user/temp/OUTPUT.GIF
If the output is too large, try dropping the levels or go to o2x2 for a bigger size drop.
Also take a look at this for more tips.
Other
Gimp - I'm not a huge user of Gimp. It does too much and I find the command line easier.
G'MIC gimp plugin - Many different artistic conversions, has preview function.
Gimp Plug-Ins Registry - If you're going to use Gimp, then plug-ins and scripts are a must have.
Image processing utilitiesImage to ASCII ArtAnother Image to ASCII Art generator
stereograph/xstereograph ("magic eye" stereogram tools for Linux! yay!)
Photomosaics
metapixel (really nice! Very professional results!)
pixelize (also very nice!)
Here is a quick tutorial on using metapixel:
First you need to prepare your source images.
$ metapixel-prepare -r /source_dir /destination_dir --width=24 --height=24
You can do that for each source directory full of images. Note,
this is a recursive operation, so if you have all your images under one
directory with sub-directories, they all get processed.
$ metapixel --metapixel input.jpg output.png --library /destination_dir --scale=35 --distance=500
or try this
$ metapixel --metapixel input.jpg output.png -l /destination_dir1 -l
/destination_dir1 -l /destination_dir1 --scale=15 --distance=3
The example above is using 3 directories of prepared tile images.
Play with scale and destination to suit your needs. Read the man page before proceeding.