Inserted an option to choose to use GD or ImageMagick; some minor changes;