diff --git a/imageapi_imagemagick.module b/imageapi_imagemagick.module
index 3171d0b..5a74d09 100644
--- a/imageapi_imagemagick.module
+++ b/imageapi_imagemagick.module
@@ -29,6 +29,13 @@ function imageapi_imagemagick_settings_form() {
'#element_validate' => array('imageapi_imagemagick_quality_element_validate'),
);
+ $form['imageapi_imagemagick_extra_commands'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Extra ImageMagick command line options. One per line'),
+ '#description' => t('Add in things like:"
-colorspace RGB
-type optimize
-strip"'),
+ '#default_value' => variable_get('imageapi_imagemagick_extra_commands', ''),
+ );
+
$form['imageapi_imagemagick_binary'] = array(
'#type' => 'fieldset',
'#title' => t('ImageMagick Binary'),
@@ -145,7 +152,20 @@ function imageapi_imagemagick_image_desaturate(&$image) {
* Calls the convert executable with the specified filter.
*/
function _imageapi_imagemagick_convert($source, $dest, $args) {
+ // Add in quality.
$args['quality'] = '-quality '. escapeshellarg(variable_get('imageapi_imagemagick_quality', 75));
+
+ // Add in extra commands.
+ if ($commands = variable_get('imageapi_imagemagick_extra_commands', '')) {
+ $array = explode("\n", $commands);
+ foreach ($array as $key => $value) {
+ $value = trim($value);
+ if (empty($value)) {
+ continue;
+ }
+ $args['global_extra' . $key] = $value;
+ }
+ }
// To make use of ImageMagick 6's parenthetical command grouping we need to make
// the $source image the first parameter and $dest the last.
// See http://www.imagemagick.org/Usage/basics/#cmdline for more info.