ImageMagick

From Omnia
Jump to navigation Jump to search

ImageMagick

ImageMagick: Convert, Edit, Or Compose Bitmap Images - http://www.imagemagick.org/‎

ImageMagick: Scripts - http://www.imagemagick.org/script/index.php

Installation

Installing from Yum

yum install ImageMagick

Installing from Source

ImageMagick: Install from Source - http://www.imagemagick.org/script/install-source.php#unix

Example of compiling version 6.6.7-0:

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd ImageMagick-*
./configure --prefix=/opt/ImageMagick
make
sudo make install

Resize Image

convert -resize 440 ubuntu1.jpg ubuntu1.jpg

References:

Image Composite

Watermark Image

Watermark and Merge Photos

while true ; do x=$(( 50 + $RANDOM % 600)) ; y=$(( 50 + $RANDOM % 400)) ; composite -dissolve 20% -geometry +$x+$y -quality 100 ghost1_2.png camera.jpg out.jpg ; sleep .5 ; done
composite -dissolve 50% -quality 100 lnl.png fu.jpg output.jpg
composite -dissolve 50% -gravity center -quality 100 Watermark.png Tux.jpg Tuxwm.jpg
composite -dissolve 50% -gravity center -quality 100 \( Watermark.png -resize 50% \) Tux.jpg Tux.jpg
composite -compose atop -geometry -13-17 white-highlight.png red-circle.png red-ball.png
composite -compose atop -geometry +75 -gravity southeast ./watermark.png ./photo.jpg ./photo-watermarked.jpg
composite -compose bumpmap -gravity southeast watermark.jpg input.jpg output.jpg
montage Pic1.jpg Pic2.jpg -geometry +2+2 Result.png

References:

Watermark Text

convert -size 500x404 xc:transparent -font Courier-bold -pointsize 25 -fill SlateBlue1 -draw "text 230,375 'linuxandlife.com'" output.png
composite -dissolve 50% -quality 100 lnl.png fu.jpg output.jpg

References:

Date Stamp Photos: [1]

convert -pointsize 65 -font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf  -fill white -stroke black -strokewidth 1 \
  -draw "text 10,230 \"$(date "+%H:%M %d.%m.%Y"|sed -e ' s/\"/\\\"/g' )\"" /var/www/feeder1.jpg /var/www/feeder2.jpg  
#!/bin/bash
datte=$(date)
convert -pointsize 22 -fill white -draw 'text 2270,1940 "'" $datte"' " ' /root/minute.jpg /root/snapshot3.jpg

More Date Stamp Examples: [2]

date_time=$(date)
convert PICT0001.JPG -font Arial -pointsize 20 -fill yellow -annotate +450+440 "$date_time" PICT0001_trans.jpg

Image Compare

Differences highlighted in red:

compare img1.jpg img2.jpg  out.jpg

Black and white compare (easier to see differences)

compare  -highlight-color White -lowlight-color Black  img1.jpg img2.jpg  out.jpg

Better option is to do a difference composite:

composite -compose difference  img1.jpg img2.jpg  out.gif

References: