ImageMagick
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:
- Resize and Watermark Images in Linux | SavvyAdmin.com - http://savvyadmin.com/resize-and-watermark-images-in-linux/
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:
- ImageMagick: Command-line Tools: Composite - http://www.imagemagick.org/script/composite.php
- How To Watermark Images With ImageMagick in Linux : Tux Tweaks - http://tuxtweaks.com/2009/08/howto-watermark-images-imagemagick-linux/
- How to automatically watermark or batch watermark photos using ImageMagick | xoogu - http://www.xoogu.com/2013/how-to-automatically-watermark-or-batch-watermark-photos-using-imagemagick/
- How do I create watermark with ImageMagick’s composite command in Linux? - http://www.cyberciti.biz/faq/how-do-i-create-watermark-with-imagemagicks-composite-command-in-linux/
- Merge photos with ImageMagick « Marcos Orfila - http://www.marcosorfila.com/site/unir-fotos-con-imagemagick/
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:
- Use Imagemagick to add watermark to images ~ Linux and Life - http://www.linuxandlife.com/2012/07/use-imagemagick-to-add-watermark-to.html
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:
- Comparing -- IM v6 Examples - http://www.imagemagick.org/Usage/compare/