a repository due to missing 'name' attribute from the API list=allimages
* (bug 24898) MediaWiki uses /tmp even if a vHost-specific tempdir is set, also
make wfTempDir() return a sane value for Windows on worst-case
+* (bug 24824) Support ImageMagick 6.5.6-2+ JPEG decoder size hint, to reduce
+ memory usage when such an ImageMagick is used for scaling.
+* Disable multithreaded behaviour in recent ImageMagick, to avoid a deadlock
+ when a resource limit such as $wgMaxShellMemory is hit.
=== API changes in 1.17 ===
* (bug 22738) Allow filtering by action type on query=logevent.
$scene = false;
$animation_pre = '';
$animation_post = '';
+ $decoderHint = '';
if ( $mimeType == 'image/jpeg' ) {
$quality = "-quality 80"; // 80%
# Sharpening, see bug 6193
if ( ( $physicalWidth + $physicalHeight ) / ( $srcWidth + $srcHeight ) < $wgSharpenReductionThreshold ) {
$sharpen = "-sharpen " . wfEscapeShellArg( $wgSharpenParameter );
}
+ // JPEG decoder hint to reduce memory, available since IM 6.5.6-2
+ $decoderHint = "-define jpeg:size={$physicalWidth}x{$physicalHeight}";
} elseif ( $mimeType == 'image/png' ) {
$quality = "-quality 95"; // zlib 9, adaptive filtering
} elseif( $mimeType == 'image/gif' ) {
$tempEnv = '';
}
- # Specify white background color, will be used for transparent images
- # in Internet Explorer/Windows instead of default black.
-
- # Note, we specify "-size {$physicalWidth}" and NOT "-size {$physicalWidth}x{$physicalHeight}".
- # It seems that ImageMagick has a bug wherein it produces thumbnails of
- # the wrong size in the second case.
-
$cmd =
$tempEnv .
+ // Use one thread only, to avoid deadlock bugs on OOM
+ 'OMP_NUM_THREADS=1 ' .
wfEscapeShellArg( $wgImageMagickConvertCommand ) .
- " {$quality} -background white -size {$physicalWidth} ".
+ // Specify white background color, will be used for transparent images
+ // in Internet Explorer/Windows instead of default black.
+ " {$quality} -background white".
+ " {$decoderHint} " .
wfEscapeShellArg( $this->escapeMagickInput( $srcPath, $scene ) ) .
" {$animation_pre}" .
- // For the -resize option a "!" is needed to force exact size,
+ // For the -thumbnail option a "!" is needed to force exact size,
// or ImageMagick may decide your ratio is wrong and slice off
// a pixel.
" -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .