r71547 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71546‎ | r71547 | r71548 >
Date:08:50, 24 August 2010
Author:tstarling
Status:deferred
Tags:
Comment:
MFT r71546: ImageMagick fixes to replace live hacks.
Modified paths:
  • /branches/wmf/1.16wmf4/includes/media/Bitmap.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/media/Bitmap.php
@@ -115,12 +115,15 @@
116116 $sharpen = '';
117117 $scene = false;
118118 $animation = '';
 119+ $decoderHint = '';
119120 if ( $mimeType == 'image/jpeg' ) {
120121 $quality = "-quality 80"; // 80%
121122 # Sharpening, see bug 6193
122123 if ( ( $physicalWidth + $physicalHeight ) / ( $srcWidth + $srcHeight ) < $wgSharpenReductionThreshold ) {
123124 $sharpen = "-sharpen " . wfEscapeShellArg( $wgSharpenParameter );
124125 }
 126+ // JPEG decoder hint to reduce memory, available since IM 6.5.6-2
 127+ $decoderHint = "-define jpeg:size={$physicalWidth}x{$physicalHeight}";
125128 } elseif ( $mimeType == 'image/png' ) {
126129 $quality = "-quality 95"; // zlib 9, adaptive filtering
127130 } elseif( $mimeType == 'image/gif' ) {
@@ -140,20 +143,18 @@
141144 $tempEnv = '';
142145 }
143146
144 - # Specify white background color, will be used for transparent images
145 - # in Internet Explorer/Windows instead of default black.
146 -
147 - # Note, we specify "-size {$physicalWidth}" and NOT "-size {$physicalWidth}x{$physicalHeight}".
148 - # It seems that ImageMagick has a bug wherein it produces thumbnails of
149 - # the wrong size in the second case.
150 -
151147 $cmd =
152148 $tempEnv .
 149+ // Use one thread only, to avoid deadlock bugs on OOM
 150+ 'OMP_NUM_THREADS=1 ' .
153151 wfEscapeShellArg( $wgImageMagickConvertCommand ) .
154 - " {$quality} -background white -size {$physicalWidth} ".
 152+ // Specify white background color, will be used for transparent images
 153+ // in Internet Explorer/Windows instead of default black.
 154+ " {$quality} -background white".
 155+ " {$decoderHint} " .
155156 wfEscapeShellArg( $this->escapeMagickInput( $srcPath, $scene ) ) .
156157 $animation .
157 - // For the -resize option a "!" is needed to force exact size,
 158+ // For the -thumbnail option a "!" is needed to force exact size,
158159 // or ImageMagick may decide your ratio is wrong and slice off
159160 // a pixel.
160161 " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
Property changes on: branches/wmf/1.16wmf4/includes/media/Bitmap.php
___________________________________________________________________
Modified: svn:mergeinfo
161162 Merged /trunk/phase3/includes/media/Bitmap.php:r71546

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71546Fixes for new ImageMagick:...tstarling08:48, 24 August 2010

Status & tagging log