ImageMagick

From TheAlmightyGuru
Revision as of 16:36, 14 August 2017 by TheAlmightyGuru (talk | contribs)
Jump to: navigation, search

Imagemagick is a cross-platform image editing program that uses a scripting language to create, edit, and convert between over 200 different image formats. It can be run in various forms including a command-line program, invoked as an object, as a PHP module, and various others.

Useful Scripts

Invoking In JScript

Imagemagick can be installed on Windows to allow it to be accessed as an object by the OS, but it isn't turned on by default, you must do it in the installer. Here is an example that creates a square JPEG image.

var oIM = new ActiveXObject("ImageMagickObject.MagickImage.1");
oIM.convert("-size", "512x512", "xc:white", 
 "-fill", "white", "-stroke", "black", "-draw", "rectangle 0,0 511,511", 
 "-fill", "blue", "-stroke", "none", "-font", "Tahoma", "-pointsize", "48", "-gravity", "center", "-draw", "text 0,0 'Square'", 
 "-quality", "90%", "Square.jpg");

Make a Picture Book

This script will take a folder full of JPEGs and make a PDF document out the them where each page of the PDF has a single image centered on the page. The page size specified here yields a standard letter size (8.5" x 11") at 72 DPI.

magick *.jpg -gravity center -extent 612x792 -density 72 output.pdf

Links