2012-07-28

Creating an animated gif image

Imagemagick can also be used to create animations!

convert -delay 10 -loop 0 DSC003* animation.gif

Where DSC003* are the files that are going to be used for the animations. They can be in about any format.

As a (rather stupid) example, I created 16 barplots in R with different colors and animated this:

in R:
$ pdf('example.pdf')
$ for (i in seq(5,20)){barplot(1:20,col=rainbow(i))}
$ dev.off()

in Shell:
$ convert example.pdf example.png
$ convert -delay 10 -loop 1 example-*png animation.gif


The 16 different barplots.
The slightly psychedelic animation.








How to bulk resize JPEG pictures via Imagemagick

Sometimes you need to reduce the size of many pictures, for example to share them on the internet.

A nice way of doing this is via Shell:

convert FILE.JPG -resize 2448x1836 ./smaller_pictures/FILE.JPG

Or by using a for loop:

for F in *.JPG
do
convert $F -resize 2448x1836 ./smaller_pictures/$F
done

2012-07-17

How to get nice Python Syntax Highlighting in LaTeX documents

Pygmentize is a command that can be performed on a python Script to produce a .tex document with nice syntax highlighting

pygmentize -f latex script.py > script.tex

2012-07-14

How to install .deb packages on Linux

$ sudo dpkg -i package.deb

2012-07-08

Pickle module in Python

The pickle module in Python 2.3 can be used to save a dictionary in a file and makes it accessible for later.

import pickle

((I will add more information later))