notebook This is my personal notebook ^_^

Notes Image crop and gif animation

Script for crop png files:

#!/bin/bash
# crop white space for images in a directory
for X in *.png
do
    echo $X
    convert -trim $X $X
done
exit
# eof

Script for making a gif animation:

#!/bin/bash
# convert png to jpg, and then make a gif with delay in 1/100 seconds, and cycle(1) or not (0).
mogrify -format jpg *.png
convert -delay 10 -loop 0 *.jpg my_animation.gif

Script for combing multiple pictures into one picture:

#!/bin/bash
# Combine horizontally
convert in-1.jpg in-2.jpg +append outh.jpg
# Combine vertically
convert in-1.jpg in-2.jpg -append outv.jpg

Note: to use the convert command, you need to install ImageMagic.

About delegate libraries:

  • try install imagemagick-devel and libpng-devel