diff --git a/imagemagick.api.php b/imagemagick.api.php
index 12cd907..8975e37 100644
--- a/imagemagick.api.php
+++ b/imagemagick.api.php
@@ -67,3 +67,26 @@ function hook_imagemagick_save_alter(stdClass $image, $context = array()) {
 function hook_imagemagick_arguments_alter($args, $context = array()) {
 }
 
+/**
+ * Alter the arguments to the ImageMagick 'convert' command-line program, after
+ * source and destination arguments are included.
+ *
+ * @param $args
+ *   An array of arguments to the ImageMagick 'convert' command-line program.
+ * @param $context
+ *   An associative array of information about the image being altered:
+ *   - source: The filesystem path of the original image.
+ *   - source_original: The original file URI of the image.
+ *   - destination: The filesystem path for the derivative image.
+ *   - destination_original: The original file URI for the derivative image.
+ *   - destination_format: The target image format for the derivative image.
+ *     Defaults to an empty string.
+ *
+ * @see _imagemagick_convert()
+ */
+function hook_imagemagick_command_arguments_alter($args, $context = array()) {
+  // Prepend some option before the source argument.
+  if (!empty($args['some-option'])) {
+    $args = array('some-option' => $args['some-option']) + $args;
+  }
+}
diff --git a/imagemagick.module b/imagemagick.module
index 804338f..f3d19f6 100644
--- a/imagemagick.module
+++ b/imagemagick.module
@@ -413,6 +413,12 @@ function _imagemagick_convert($source, $destination, $args) {
     array_unshift($args, escapeshellarg($source));
     $args[] = escapeshellarg($destination_format);
   }
+
+  // Allow final altering of arguments, in case they need to be re-arranged.
+  // For example, when converting PDFs with the density argument, it should
+  // prepend the source argument.
+  drupal_alter('imagemagick_command_arguments', $args, $context);
+
   $command_args = implode(' ', $args);
 
   if (_imagemagick_convert_exec($command_args, $output, $error) !== TRUE) {
