Concluding
If you copied the parts of the script and saved it in your image directory, it's ready for use. Just enter the url to the script, a slash, then the name of your image and a query string. You should now get the image, modified to suit your needs.
For those of you who don't like to copy-paste: you can download the full script.
Tip
Maybe you don't like the ugly .php part in your url (I don't). You can edit your Apache's configuration file, or place a .htaccess file in your images directory and add the line:
DefaultType application/x-httpd-php
You can then rename the script to something without .php (ie. just magick). The url is now much nicer.