Jump to content

Manual talk:$wgImageMagickConvertCommand

Add topic
From mediawiki.org

How can I verify whether this magickConvert works properly in the process of uploading file, but the result of uploading is failed? --Mints 01:59, 20 May 2009 (UTC)Reply

Solution for GraphicsMagick issues on 1.23.x

[edit]

In MediaWiki 1.23.x I had received a number of issues including Unrecognized command 'quality'. and while trying to setup GraphicsMagick instead of ImageMagick. The issue was that /etc/bin/gm was expecting /etc/bin/gm convert. Setting the $wgImageMagickConvertCommand to include "convert" just causes the wfShellEcecWithStderr() to throw the No such file or directory error. A solution I found was to add array( "convert"), after the $wgImageMagickConvertCommand inside the Bitmap.php file.

 $cmd = call_user_func_array( 'wfEscapeShellArg', array_merge(
     array( $wgImageMagickConvertCommand ),
     array( "convert"),
     $quality,
     // Specify white background color, will be used for transparent images
     // in Internet Explorer/Windows instead of default black.

Hope somebody finds this while scouring the web, because I searched every combination of the above words I could think of and found nothing related. Pale2hall (talk) 04:12, 8 October 2014 (UTC)Reply

Alternatively: create a script

[edit]

I ran into the same problem. I rather prefer not to mess around with internal files. Therefore, I thought about creating a script which executes GraphicsMagick with an additional parameter convert. For example,

  1. create a file /opt/gmconvert.sh
    #!/bin/bash
    gm convert $@
    
  2. make it executable
    chmod 755 /opt/gmconvert.sh
    
  3. update the command in LocalSettings.php
    $wgImageMagickConvertCommand = "/opt/gmconvert.sh";
    

- Christoph, 179.104.247.35 15:09, 28 May 2015 (UTC)Reply

via LocalSettings.php

[edit]

The script solution gives the following error

[thumbnail] thumbnail failed on mywiki: error 1 "-quality 80 -background white -define jpeg:size=422x750 /var/www/html/wiki/images/7/71/MyImage.JPG -thumbnail 750x422! -set comment File source: http://mywiki.org/wiki/File:MyImage.JPG -depth 8 -sharpen 0x0.4 -rotate -90 /tmp/transform_a598e9922eeb-1.jpg

Reason: The quotation marks in -set comment "File source: http://mywiki.org/wiki/File:MyImage.JPG" are not passed on.

Here is a working example using internal variables in LocalSettings.php:

$wgUseImageMagick = false;
$wgCustomConvertCommand = "gm convert %s -resize %wx%h %d";

$wgSVGConverters['GraphicMagick'] = '/usr/bin/gm convert -background none -thumbnail $widthx$height\! $input PNG:$output';
$wgSVGConverter = 'GraphicMagick';

# For extension PdfHandler 
# Adapted solution from above. "gm convert" results in error message "[thumbnail] thumbnail failed on XXX: error 127 "/bin/bash: gm convert: command not found"
$wgPdfPostProcessor = "/opt/gmconvert.sh";

See also

Cjahn (talk) 19:21, 28 May 2015 (UTC)Reply