Index: branches/wmf/1.16wmf4/includes/media/Bitmap.php |
— | — | @@ -115,12 +115,15 @@ |
116 | 116 | $sharpen = ''; |
117 | 117 | $scene = false; |
118 | 118 | $animation = ''; |
| 119 | + $decoderHint = ''; |
119 | 120 | if ( $mimeType == 'image/jpeg' ) { |
120 | 121 | $quality = "-quality 80"; // 80% |
121 | 122 | # Sharpening, see bug 6193 |
122 | 123 | if ( ( $physicalWidth + $physicalHeight ) / ( $srcWidth + $srcHeight ) < $wgSharpenReductionThreshold ) { |
123 | 124 | $sharpen = "-sharpen " . wfEscapeShellArg( $wgSharpenParameter ); |
124 | 125 | } |
| 126 | + // JPEG decoder hint to reduce memory, available since IM 6.5.6-2 |
| 127 | + $decoderHint = "-define jpeg:size={$physicalWidth}x{$physicalHeight}"; |
125 | 128 | } elseif ( $mimeType == 'image/png' ) { |
126 | 129 | $quality = "-quality 95"; // zlib 9, adaptive filtering |
127 | 130 | } elseif( $mimeType == 'image/gif' ) { |
— | — | @@ -140,20 +143,18 @@ |
141 | 144 | $tempEnv = ''; |
142 | 145 | } |
143 | 146 | |
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 | | - |
151 | 147 | $cmd = |
152 | 148 | $tempEnv . |
| 149 | + // Use one thread only, to avoid deadlock bugs on OOM |
| 150 | + 'OMP_NUM_THREADS=1 ' . |
153 | 151 | 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} " . |
155 | 156 | wfEscapeShellArg( $this->escapeMagickInput( $srcPath, $scene ) ) . |
156 | 157 | $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, |
158 | 159 | // or ImageMagick may decide your ratio is wrong and slice off |
159 | 160 | // a pixel. |
160 | 161 | " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) . |
Property changes on: branches/wmf/1.16wmf4/includes/media/Bitmap.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
161 | 162 | Merged /trunk/phase3/includes/media/Bitmap.php:r71546 |