Index: trunk/phase3/includes/media/Bitmap.php |
— | — | @@ -120,12 +120,15 @@ |
121 | 121 | $scene = false; |
122 | 122 | $animation_pre = ''; |
123 | 123 | $animation_post = ''; |
| 124 | + $decoderHint = ''; |
124 | 125 | if ( $mimeType == 'image/jpeg' ) { |
125 | 126 | $quality = "-quality 80"; // 80% |
126 | 127 | # Sharpening, see bug 6193 |
127 | 128 | if ( ( $physicalWidth + $physicalHeight ) / ( $srcWidth + $srcHeight ) < $wgSharpenReductionThreshold ) { |
128 | 129 | $sharpen = "-sharpen " . wfEscapeShellArg( $wgSharpenParameter ); |
129 | 130 | } |
| 131 | + // JPEG decoder hint to reduce memory, available since IM 6.5.6-2 |
| 132 | + $decoderHint = "-define jpeg:size={$physicalWidth}x{$physicalHeight}"; |
130 | 133 | } elseif ( $mimeType == 'image/png' ) { |
131 | 134 | $quality = "-quality 95"; // zlib 9, adaptive filtering |
132 | 135 | } elseif( $mimeType == 'image/gif' ) { |
— | — | @@ -150,20 +153,18 @@ |
151 | 154 | $tempEnv = ''; |
152 | 155 | } |
153 | 156 | |
154 | | - # Specify white background color, will be used for transparent images |
155 | | - # in Internet Explorer/Windows instead of default black. |
156 | | - |
157 | | - # Note, we specify "-size {$physicalWidth}" and NOT "-size {$physicalWidth}x{$physicalHeight}". |
158 | | - # It seems that ImageMagick has a bug wherein it produces thumbnails of |
159 | | - # the wrong size in the second case. |
160 | | - |
161 | 157 | $cmd = |
162 | 158 | $tempEnv . |
| 159 | + // Use one thread only, to avoid deadlock bugs on OOM |
| 160 | + 'OMP_NUM_THREADS=1 ' . |
163 | 161 | wfEscapeShellArg( $wgImageMagickConvertCommand ) . |
164 | | - " {$quality} -background white -size {$physicalWidth} ". |
| 162 | + // Specify white background color, will be used for transparent images |
| 163 | + // in Internet Explorer/Windows instead of default black. |
| 164 | + " {$quality} -background white". |
| 165 | + " {$decoderHint} " . |
165 | 166 | wfEscapeShellArg( $this->escapeMagickInput( $srcPath, $scene ) ) . |
166 | 167 | " {$animation_pre}" . |
167 | | - // For the -resize option a "!" is needed to force exact size, |
| 168 | + // For the -thumbnail option a "!" is needed to force exact size, |
168 | 169 | // or ImageMagick may decide your ratio is wrong and slice off |
169 | 170 | // a pixel. |
170 | 171 | " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) . |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -303,6 +303,10 @@ |
304 | 304 | a repository due to missing 'name' attribute from the API list=allimages |
305 | 305 | * (bug 24898) MediaWiki uses /tmp even if a vHost-specific tempdir is set, also |
306 | 306 | make wfTempDir() return a sane value for Windows on worst-case |
| 307 | +* (bug 24824) Support ImageMagick 6.5.6-2+ JPEG decoder size hint, to reduce |
| 308 | + memory usage when such an ImageMagick is used for scaling. |
| 309 | +* Disable multithreaded behaviour in recent ImageMagick, to avoid a deadlock |
| 310 | + when a resource limit such as $wgMaxShellMemory is hit. |
307 | 311 | |
308 | 312 | === API changes in 1.17 === |
309 | 313 | * (bug 22738) Allow filtering by action type on query=logevent. |