Ron Savage has a great set of Perl tutorials
here
How to make a simple X-program that uses ImageMagick
see ImageMagickXSlideShow
Making an MPEG from JPEGs
If you have installed the MPEG delegate, use
convert *.jpg file.mpg (for mpeg-1)
convert *.jpg file.m2v (for mpeg-2)
convert -adjoin file1.jpg file2.jpg file3.jpg movie.mpeg
Build Options
When I built version 6.0.1 on 5/25/04, I used (with Intel compiler flags)...
./configure CC=icc CXX=icc CXXFLAGS="-xK -tpp6 -O3" CFLAGS="-xK -tpp6 -O3" --enable-lzw --with-windows-font-dir=/usr/share/fonts/TrueType --with-jp2=yes --with-quantum-depth=8 --with-x=yes CPPFLAGS="-I/root/libpng-1.2.5 -I/usr/local/include"
When I built version 5.4.2 on 1/7/02, I used...
configure --enable-lzw --with-ttf-fontpath=/usr/share/fonts/TrueType
Notes:
- I failed to get JPEG v2 (
--with-jp2=yes) to work...but it's not needed at least today. This is a new spec (the JPEG-2000 thing) that uses wavelet compression. However, I could not get the jasper package to compile, sadly because the script couldn't make it past some mundane things like measuring the size of shorts. I hacked the script, but realized I'd have to do like 8 more hacks, and I've never seen a .pnm JPEG-2000 file.
- Though the specs say
--with-quantum-depth defaults to '8', on my system it defaulted to 16. This means it assumes 16 bits per pixel vs. 8. OUCH! That means lots more memory and processing. I wonder if that was why operations seemed to take a long time on the older server.
- I spent A LOT of time recompiling all the delegate packages (MPEG2, JPEG, TIFF and more) because my RedHat install fails to provide header files in most cases. So, I took this chance to recompile all these with the Intel compiler which went very smoothly.
- For some reason ImageMagick didn't overwrite the old binary utilities. So I had to copy those manually. I also have no idea whether it updated the PerlMagick files, and am still trying to figure out how to make sure the entire install is up to date.
Is there any way to create progessive JPEG's from non-progressive ones through ImageMagick?
convert infile.jpg -interlace Line outfile.jpg
Generating a thumbnail
(See a Perl Example)
Creates a thumbnail of
original.jpg iff it is bigger than
100x100 in size. This also forces the aspect ratio to stay the same. Append a
! to the
100x100> to force an aspect ratio override. The
+convert "*" removes profile information so you end up with a smaller file.
convert -scale '100x100>' +profile "*" original.jpg output.jpg
This one scales down, adds some padding if the picture isn't square and sticks some text on it.
convert ../IMG_0814.JPG -thumbnail '200x200>' miff:- | composite -gravity center - -size 200x200 xc:black miff:- | montage -gravity south -font Arial-Black -fill black -pointsize 20 -draw 'text 0,0 "CLICK to enlarge"' -fill white -pointsize 20 -draw 'text 3,3 "CLICK to enlarge"' - out.JPG
Sticking one image on another
sticks
watermark.gif on top of
atest.jpg starting at 20, 300 and outputs to
aout.jpg. Note, the
-geometry specifier has to be at the end because of a bug
composite -compose bumpmap watermark.gif atest.jpg -geometry "+20+300" aout.jpg
same thing, but orients it at the south
composite -compose bumpmap -gravity south watermark.jpg neon1.jpg aout.jpg
How I can more cleanly reduce colors in an image?
If you are color reducing an image, say for example from JPEG to GIF,
you may find reds/greens/blue showing up in areas of mostly uniform grays.
To stop this, use the YUV colorspace:
convert -colorspace YUV -colors 256 image.jpg image.gif
--
MattWalsh - 28 Dec 2001