msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

25 Nov 2007 Create a photo montage using imagemagick

This is a little bash script I put together to create a photo montage with 5 resized pitures in max 3 rows using imagemagick. The script is run from within the folder I have filled with the JPG images I want to create a montage from.

#!/bin/bashfor image in `ls *.JPG`  do    convert -resize 50x50! $image small-$image  donemontage small-*.JPG -mode Concatenate -tile 5x3 montage_final.jpg

The result file like the one below is saved with the filename montage_final.jpg.
Montage finalOne disadvantage using this technique is that it doesn’t keep the aspect ratio of the pictures.
You find more examples of montage usage by visiting the ImageMagick v6 Examples — Montage, Arrays of Images page.

Tags: , , , ,

Posted by

30 Sep 2007 Text to image using imagemagick

convert -size 200x30 xc:transparent -font /usr/share/fonts/dejavu/DejaVuSansMono.ttf -fill black -pointsize 12 -draw "text 5,15 'this is just a test'" test.png

Tags: , ,

Posted by

14 Aug 2007 Watermark pictures using exiv2

Quick and dirty batch script to watermark and add IPTC data to a set of files in the supplied dir to -Copyright.

#!/bin/bash
# Copyright Andy Wright - www.litost.org 2006.
# You have permission to do what you want with it as long as you don't
# blame me if it insults your mother etc. :).
# Std disclaimers apply.
# Quick and dirty batch script to watermark and add IPTC data to a set of
# files in the supplied dir to -Copyright.

# Needs:
# ImageMagick - http://www.imagemagick.org/
# Exiv2 - http://www.exiv2.org/

CopyrightStr="Copyright String"
CreditStr="Credit String"

Exiv2=/usr/local/exiv2/bin/exiv2
Composite=/usr/bin/composite
CopyrightImg=Copyright.png
Quality=96

inDir=$1
[ -z "$inDir" ] && cat < < EOF && exit 1
Add watermark and IPTC data to all the files in  -> -Copyright
Warning probably only works on relative directories.
Usage: $0 
EOF

outDir=$inDir-Copyright
test -d $outDir || mkdir $outDir

renice 15 -p $$

for file in $(ls -1 $inDir/*.{jpg,JPG} | sed -e "s/^$inDir\///")
do
    infile=$inDir/$file
    outfile=$outDir/$file
    echo "Adding IPTC data to $file"
    $Exiv2 -M"set Iptc.Application2.Copyright String $CopyrightStr" $infile
    $Exiv2 -M"set Iptc.Application2.Credit String $CreditStr" $infile
    $Exiv2 -M"set Iptc.Application2.TransmissionReference String $file" $infile

    echo "Copyrighting $file"
    $Composite -quality $Quality -gravity southeast $CopyrightImg $infile $outfile
done

Source: http://www.litost.org/copyright.sh.txt

Tags: , , , ,

Posted by

02 Feb 2007 Improved watermark script with imagemagick

#!/bin/bash
# Use a shell loop
#mkdir thumbnails
if [ ! -f *.JPG ] ; then
        echo "Ingen filer tilgjengelig!"
else
for file in *.JPG
do
        width=`identify -format %w ${file}`; \
        convert -background '#0008' -fill white -gravity center -size ${width}x90 \
        -font Sketchy  -pointsize 50 \
        caption:"Copyright © 2007 Pario.no" \
        +size ${file} +swap -gravity north -composite  thumbnails/${file};
#       rm ${file}
done
fi

Tags: , , , ,

Posted by

02 Feb 2007 Resize of images in a folder with imagemagick

#!/bin/bash
# Hans-Henry Jakobsen
# Script som bl.a resizer bilder og legger de i rett mappe
# NB! ikke bruk originalfil da dette script sletter fila

# Sjekker at mapper eksisterer
if [ ! -d 320 ]
        then
        mkdir 320
fi
if [ ! -d 480 ]
        then
        mkdir 480
fi

for file in  $(ls|grep JPG)
do
        base320=`basename $file .JPG`_Resized_320.png
        base480=`basename $file .JPG`_Resized_480.png

        convert $file -resize 320 $base320
        convert $file -resize 480 $base480

        #320px
        convert $base320 -background black \
        -font Verdana -pointsize 10 -fill black \
        -gravity center -set caption "Copyright \© 2007 Pario.no"  +polaroid \
        320/$base320;

        #480px
        convert $base320 -background black \
        -font Verdana -pointsize 10 -fill black \
        -gravity center -set caption "Copyright \© 2007 Pario.no"  +polaroid \
        480/$base480;

        # Sletter temp filer
        rm $base320
        rm $base480
        # Ikke bruk originalfil da den blir slettet!
        rm ${file}
done

# Ordner rettigheter
chmod g+rw 320/*
chmod g+rw 480/*
chgrp knausen 320 -R
chgrp knausen 480 -R

Tags: , , , , ,

Posted by