Changeset 930342
- Timestamp:
- 06/11/2014 12:29:17 PM (11 years ago)
- Location:
- imagemagick-sharpen-resized-images
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
imagemagick-sharpen-resized-images/tags/1.1.3/imagick-sharpen-resized-images.php
r927867 r930342 1 1 <?php 2 2 3 /* 4 3 5 Plugin Name: ImageMagick Sharpen Resized Images 6 4 7 Plugin URI: http://www.hansvaneijsden.com/wordpress-sharpen-resized-images-plugin/ 8 5 9 Description: Improve your images: Sharpens resized JPG image uploads via ImageMagick so it keeps quality, EXIF information, color profiles and crops. 10 6 11 Author: Hans van Eijsden 12 7 13 Author URI: http://www.hansvaneijsden.com/ 8 Version: 1.1.2 14 15 Version: 1.1.3 16 9 17 License: GPL v3 10 18 19 20 11 21 This program is free software: you can redistribute it and/or modify 22 12 23 it under the terms of the GNU General Public License as published by 24 13 25 the Free Software Foundation, either version 3 of the License, or 26 14 27 (at your option) any later version. 15 28 29 30 16 31 This program is distributed in the hope that it will be useful, 32 17 33 but WITHOUT ANY WARRANTY; without even the implied warranty of 34 18 35 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 19 37 GNU General Public License for more details. 20 38 39 40 21 41 You should have received a copy of the GNU General Public License 42 22 43 along with this program. If not, see <http://www.gnu.org/licenses/>. 44 23 45 */ 46 24 47 function imagick_sharpen_resized_files_register_settings() { 48 25 49 add_option('Radius','0'); 50 26 51 add_option('Sigma','0.5'); 52 27 53 add_option('Sharpening','1'); 54 28 55 add_option('Threshold','0'); 56 29 57 add_option('CompressionQuality','92'); 30 add_option('AutoConLev',true); 58 59 add_option('AutoConLev',1); 60 31 61 register_setting('imagick_sharpen_resized_files_settings','Radius'); 62 32 63 register_setting('imagick_sharpen_resized_files_settings','Sigma'); 64 33 65 register_setting('imagick_sharpen_resized_files_settings','Sharpening'); 66 34 67 register_setting('imagick_sharpen_resized_files_settings','Threshold'); 35 register_setting('imagick_sharpen_resized_files_settings','AutoConLev'); 68 69 register_setting('imagick_sharpen_resized_files_settings','AutoConLev','save_ACL'); 70 36 71 register_setting('imagick_sharpen_resized_files_settings','CompressionQuality'); 37 72 73 74 38 75 } 39 76 77 78 40 79 function imagick_sharpen_resized_files_register_options_page() { 80 41 81 add_options_page('ImageMagick Sharpen Resized Images','IM Sharpen Images','manage_options',__FILE__,'imagick_sharpen_resized_files_options_page'); 82 42 83 } 43 84 44 85 86 87 function save_ACL ( $input ) { 88 89 $option = get_option('AutoConLev'); 90 91 if ( ! isset( $input ) || $input != 1 ) { 92 93 $option = 0; 94 95 } else { 96 97 $option = 1; 98 99 } 100 101 return $option; 102 103 } 104 105 45 106 46 107 function imagick_sharpen_resized_files_deactivate(){ 108 47 109 //delete plugins option here ex: 110 48 111 delete_option('Radius'); 112 49 113 delete_option('Sigma'); 114 50 115 delete_option('Sharpening'); 116 51 117 delete_option('Threshold'); 118 52 119 delete_option('CompressionQuality'); 120 53 121 delete_option('AutoConLev'); 122 54 123 } 55 124 125 126 56 127 function imagick_sharpen_resized_files_options_page() { // Output the options page 128 57 129 ?> 130 58 131 <div class="wrap"> 132 59 133 <h2>ImageMagick Sharpen Resized Images</h2> 134 60 135 <p><a href="http://www.hansvaneijsden.com/wordpress-sharpen-resized-images-plugin/"><?php _e('Plugin Home Page'); ?></a> | 136 61 137 <a href="http://wordpress.org/plugins/imagemagick-sharpen-resized-images/"><?php _e('WordPress Plugin Page'); ?></a></p> 62 138 139 140 63 141 <p> 142 64 143 <?php 144 65 145 if (extension_loaded('imagick') || class_exists('Imagick')) 146 66 147 { 148 67 149 // imagick PHP module is installed 150 68 151 echo 'ImageMagick PHP Module: <span style="color: green; font-weight: bolder">OK, installed'; 152 69 153 } else { 154 70 155 echo 'ImageMagick PHP Module: <span style="color: red; font-weight: bolder">MISSING, not installed'; 156 71 157 } 158 72 159 ?> 160 73 161 </p> 162 74 163 <p>The default settings are great, but you can adjust them to your taste here: </p> 75 164 165 166 76 167 <form method="post" action="options.php"> 168 77 169 <?php settings_fields('imagick_sharpen_resized_files_settings'); ?> 170 78 171 <?php do_settings_sections('imagick_sharpen_resized_files_settings'); ?> 172 79 173 <table class="form-table"> 80 <tr valign="top"> 174 175 <tr valign="top"> 176 81 177 <th scope="row">Radius (0 = auto):</th> 178 82 179 <td><input type="text" name="Radius" value="<?php echo get_option('Radius'); ?>" /></td> 83 </tr> 180 181 </tr> 182 84 183 85 <tr valign="top"> 184 185 <tr valign="top"> 186 86 187 <th scope="row">Sigma:</th> 188 87 189 <td><input type="text" name="Sigma" value="<?php echo get_option('Sigma'); ?>" /></td> 88 </tr> 190 191 </tr> 192 89 193 90 <tr valign="top"> 194 195 <tr valign="top"> 196 91 197 <th scope="row">Amount Of Sharpening:</th> 198 92 199 <td><input type="text" name="Sharpening" value="<?php echo get_option('Sharpening'); ?>" /></td> 93 </tr> 94 95 <tr valign="top"> 200 201 </tr> 202 203 204 205 <tr valign="top"> 206 96 207 <th scope="row">Threshold:</th> 208 97 209 <td><input type="text" name="Threshold" value="<?php echo get_option('Threshold'); ?>" /></td> 98 </tr> 99 100 <tr valign="top"> 210 211 </tr> 212 213 214 215 <tr valign="top"> 216 101 217 <th scope="row">Compression Quality:</th> 218 102 219 <td><input type="text" name="CompressionQuality" value="<?php echo get_option('CompressionQuality'); ?>" /></td> 103 </tr> 104 105 106 <tr valign="top"> 220 221 </tr> 222 223 224 225 226 227 <tr valign="top"> 228 107 229 <th scope="row">Automatic Contrast Leveling:</th> 108 <td><input type="checkbox" <?php if (get_option('AutoConLev')==true) echo 'checked="checked" '; ?> name="AutoConLev" value="<?php echo get_option('AutoConLev'); ?>" /></td> 109 </tr> 230 231 <td><input type="checkbox" <?php if (get_option('AutoConLev')==1){ echo 'checked="checked" value="0"'; } else {echo 'value="1"';} ?> name="AutoConLev" /></td> 232 233 </tr> 234 110 235 </table> 236 111 237 238 112 239 <?php submit_button(); ?> 240 113 241 </form> 242 114 243 </div> 115 244 245 246 116 247 <div id="fb-root"></div> 248 117 249 <script>(function(d, s, id) { 250 118 251 var js, fjs = d.getElementsByTagName(s)[0]; 252 119 253 if (d.getElementById(id)) return; 254 120 255 js = d.createElement(s); js.id = id; 256 121 257 js.src = "//connect.facebook.net/nl_NL/sdk.js#xfbml=1&appId=407436179311287&version=v2.0"; 258 122 259 fjs.parentNode.insertBefore(js, fjs); 260 123 261 }(document, 'script', 'facebook-jssdk'));</script> 262 124 263 <div class="fb-like-box" data-href="https://www.facebook.com/hansvaneijsdenphotography" data-colorscheme="light" data-show-faces="false" data-header="false" data-stream="false" data-show-border="false"></div> 264 125 265 <br> 266 126 267 <a href="https://twitter.com/HansVanEijsden" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @HansVanEijsden</a> 268 127 269 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> 128 270 271 272 129 273 <?php 274 130 275 } 131 276 277 278 132 279 function imagick_sharpen_resized_files($resized_file) { 280 133 281 $image = new Imagick($resized_file); 282 134 283 $size = @getimagesize($resized_file); 284 135 285 if (!$size) 286 136 287 return new WP_Error('invalid_image', __('Could not read image size.'), $file); 288 137 289 list($orig_w,$orig_h,$orig_type) = $size; 138 290 291 292 139 293 // We only want to use our sharpening on JPG files 294 140 295 switch($orig_type) { 296 141 297 case IMAGETYPE_JPEG: 142 298 299 300 143 301 // Automatic Contrast Leveling 302 144 303 if (get_option('AutoConLev')==true) { 304 145 305 $image->normalizeImage(); 306 146 307 } 147 308 309 310 148 311 // Sharpen the image (the default is via the Lanczos algorithm) 312 149 313 $image->unsharpMaskImage(get_option('Radius'),get_option('Sigma'),get_option('Sharpening'),get_option('Threshold')); 314 150 315 316 151 317 // Store the JPG file, with as default a compression quality of 92 (default WordPress = 90, default ImageMagick = 85...) 318 152 319 $image->setImageFormat("jpg"); 320 153 321 $image->setImageCompression(Imagick::COMPRESSION_JPEG); 322 154 323 $image->setImageCompressionQuality(get_option('CompressionQuality')); 324 155 325 $image->writeImage($resized_file); 326 156 327 328 157 329 break; 330 158 331 default: 332 159 333 return $resized_file; 334 160 335 } 336 161 337 338 162 339 // Remove the JPG from memory 340 163 341 $image->destroy(); 342 164 343 344 165 345 return $resized_file; 346 166 347 } 348 167 349 350 168 351 add_filter('image_make_intermediate_size','imagick_sharpen_resized_files',900); 352 169 353 register_deactivation_hook( __FILE__,'imagick_sharpen_resized_files_deactivate'); 354 170 355 add_action('admin_init','imagick_sharpen_resized_files_register_settings'); 356 171 357 add_action('admin_menu','imagick_sharpen_resized_files_register_options_page'); 358 -
imagemagick-sharpen-resized-images/tags/1.1.3/readme.txt
r927867 r930342 6 6 Requires at least: 3.5 7 7 Tested up to: 3.9.1 8 Stable tag: 1.1. 28 Stable tag: 1.1.3 9 9 License: GPL v3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 22 22 == Installation == 23 23 24 1. Upload `imagick-sharpen-resized-images.php` to the `/wp-content/plugins/` directory 24 1. Upload `imagick-sharpen-resized-images.php` to the `/wp-content/plugins/` directory. 25 25 2. Activate the plugin through the 'Plugins' menu in WordPress. 26 26 3. In your Wordpress Settings you'll have a new admin entry: IM Sharpen Images. … … 32 32 = Are there any system requirements? = 33 33 34 Your host needs to have the [imagick PHP module](http://pecl.php.net/package/imagick) installed .35 The plugin has a built-in check.34 Your host needs to have the [imagick PHP module](http://pecl.php.net/package/imagick) installed (and, of course, the [ImageMagick](http://www.imagemagick.org) program itself). 35 The imagick PHP module is NOT a WordPress plugin, but a module for PHP. The plugin has a built-in check for this imagick PHP module. 36 36 37 If you don't have the PHP imagickmodule installed you can still sharpen your images by using the [Sharpen Resized Images](https://wordpress.org/plugins/sharpen-resized-images/) plugin. It sharpens the images by using lower quality GD, so it strips EXIF data and it strips color profiles.37 If you don't have the imagick PHP module installed you can still sharpen your images by using the [Sharpen Resized Images](https://wordpress.org/plugins/sharpen-resized-images/) plugin. It sharpens the images by using lower quality GD, so it strips EXIF data and it strips color profiles. 38 38 39 39 = I don't see any sharpening, why? = 40 40 41 41 * After you enable the plugin it will only sharpen new uploads. If you want to sharpen your already uploaded images you will also need the [Regenerate Thumbnails](http://wordpress.org/plugins/regenerate-thumbnails/) plugin. 42 * Make sure to have not only the PHP module but also the ImageMagick software installed on the server (most servers have it though). 42 43 * Still no differences? Clear your browser cache. 43 44 * If you're using Varnish cache or other server caches, empty them. … … 59 60 60 61 == Changelog == 62 63 = 1.1.3 = 64 * The Automatic Contrast Leveling checkbox bug has been fixed (thanks niwreg!) 61 65 62 66 = 1.1.2 = … … 87 91 88 92 = 1.0 = 89 This fixes the WordPress blurry images problem 90 91 == ToDo == 92 There's one thing I really want to fix: after unchecking the Automatic Contrast Leveling in Settings, it won't turn on again. Plugin needs deactivating and (re)activating to enable it again. 93 This fixes the WordPress blurry images problem. -
imagemagick-sharpen-resized-images/trunk/imagick-sharpen-resized-images.php
r927867 r930342 1 1 <?php 2 2 3 /* 4 3 5 Plugin Name: ImageMagick Sharpen Resized Images 6 4 7 Plugin URI: http://www.hansvaneijsden.com/wordpress-sharpen-resized-images-plugin/ 8 5 9 Description: Improve your images: Sharpens resized JPG image uploads via ImageMagick so it keeps quality, EXIF information, color profiles and crops. 10 6 11 Author: Hans van Eijsden 12 7 13 Author URI: http://www.hansvaneijsden.com/ 8 Version: 1.1.2 14 15 Version: 1.1.3 16 9 17 License: GPL v3 10 18 19 20 11 21 This program is free software: you can redistribute it and/or modify 22 12 23 it under the terms of the GNU General Public License as published by 24 13 25 the Free Software Foundation, either version 3 of the License, or 26 14 27 (at your option) any later version. 15 28 29 30 16 31 This program is distributed in the hope that it will be useful, 32 17 33 but WITHOUT ANY WARRANTY; without even the implied warranty of 34 18 35 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 19 37 GNU General Public License for more details. 20 38 39 40 21 41 You should have received a copy of the GNU General Public License 42 22 43 along with this program. If not, see <http://www.gnu.org/licenses/>. 44 23 45 */ 46 24 47 function imagick_sharpen_resized_files_register_settings() { 48 25 49 add_option('Radius','0'); 50 26 51 add_option('Sigma','0.5'); 52 27 53 add_option('Sharpening','1'); 54 28 55 add_option('Threshold','0'); 56 29 57 add_option('CompressionQuality','92'); 30 add_option('AutoConLev',true); 58 59 add_option('AutoConLev',1); 60 31 61 register_setting('imagick_sharpen_resized_files_settings','Radius'); 62 32 63 register_setting('imagick_sharpen_resized_files_settings','Sigma'); 64 33 65 register_setting('imagick_sharpen_resized_files_settings','Sharpening'); 66 34 67 register_setting('imagick_sharpen_resized_files_settings','Threshold'); 35 register_setting('imagick_sharpen_resized_files_settings','AutoConLev'); 68 69 register_setting('imagick_sharpen_resized_files_settings','AutoConLev','save_ACL'); 70 36 71 register_setting('imagick_sharpen_resized_files_settings','CompressionQuality'); 37 72 73 74 38 75 } 39 76 77 78 40 79 function imagick_sharpen_resized_files_register_options_page() { 80 41 81 add_options_page('ImageMagick Sharpen Resized Images','IM Sharpen Images','manage_options',__FILE__,'imagick_sharpen_resized_files_options_page'); 82 42 83 } 43 84 44 85 86 87 function save_ACL ( $input ) { 88 89 $option = get_option('AutoConLev'); 90 91 if ( ! isset( $input ) || $input != 1 ) { 92 93 $option = 0; 94 95 } else { 96 97 $option = 1; 98 99 } 100 101 return $option; 102 103 } 104 105 45 106 46 107 function imagick_sharpen_resized_files_deactivate(){ 108 47 109 //delete plugins option here ex: 110 48 111 delete_option('Radius'); 112 49 113 delete_option('Sigma'); 114 50 115 delete_option('Sharpening'); 116 51 117 delete_option('Threshold'); 118 52 119 delete_option('CompressionQuality'); 120 53 121 delete_option('AutoConLev'); 122 54 123 } 55 124 125 126 56 127 function imagick_sharpen_resized_files_options_page() { // Output the options page 128 57 129 ?> 130 58 131 <div class="wrap"> 132 59 133 <h2>ImageMagick Sharpen Resized Images</h2> 134 60 135 <p><a href="http://www.hansvaneijsden.com/wordpress-sharpen-resized-images-plugin/"><?php _e('Plugin Home Page'); ?></a> | 136 61 137 <a href="http://wordpress.org/plugins/imagemagick-sharpen-resized-images/"><?php _e('WordPress Plugin Page'); ?></a></p> 62 138 139 140 63 141 <p> 142 64 143 <?php 144 65 145 if (extension_loaded('imagick') || class_exists('Imagick')) 146 66 147 { 148 67 149 // imagick PHP module is installed 150 68 151 echo 'ImageMagick PHP Module: <span style="color: green; font-weight: bolder">OK, installed'; 152 69 153 } else { 154 70 155 echo 'ImageMagick PHP Module: <span style="color: red; font-weight: bolder">MISSING, not installed'; 156 71 157 } 158 72 159 ?> 160 73 161 </p> 162 74 163 <p>The default settings are great, but you can adjust them to your taste here: </p> 75 164 165 166 76 167 <form method="post" action="options.php"> 168 77 169 <?php settings_fields('imagick_sharpen_resized_files_settings'); ?> 170 78 171 <?php do_settings_sections('imagick_sharpen_resized_files_settings'); ?> 172 79 173 <table class="form-table"> 80 <tr valign="top"> 174 175 <tr valign="top"> 176 81 177 <th scope="row">Radius (0 = auto):</th> 178 82 179 <td><input type="text" name="Radius" value="<?php echo get_option('Radius'); ?>" /></td> 83 </tr> 180 181 </tr> 182 84 183 85 <tr valign="top"> 184 185 <tr valign="top"> 186 86 187 <th scope="row">Sigma:</th> 188 87 189 <td><input type="text" name="Sigma" value="<?php echo get_option('Sigma'); ?>" /></td> 88 </tr> 190 191 </tr> 192 89 193 90 <tr valign="top"> 194 195 <tr valign="top"> 196 91 197 <th scope="row">Amount Of Sharpening:</th> 198 92 199 <td><input type="text" name="Sharpening" value="<?php echo get_option('Sharpening'); ?>" /></td> 93 </tr> 94 95 <tr valign="top"> 200 201 </tr> 202 203 204 205 <tr valign="top"> 206 96 207 <th scope="row">Threshold:</th> 208 97 209 <td><input type="text" name="Threshold" value="<?php echo get_option('Threshold'); ?>" /></td> 98 </tr> 99 100 <tr valign="top"> 210 211 </tr> 212 213 214 215 <tr valign="top"> 216 101 217 <th scope="row">Compression Quality:</th> 218 102 219 <td><input type="text" name="CompressionQuality" value="<?php echo get_option('CompressionQuality'); ?>" /></td> 103 </tr> 104 105 106 <tr valign="top"> 220 221 </tr> 222 223 224 225 226 227 <tr valign="top"> 228 107 229 <th scope="row">Automatic Contrast Leveling:</th> 108 <td><input type="checkbox" <?php if (get_option('AutoConLev')==true) echo 'checked="checked" '; ?> name="AutoConLev" value="<?php echo get_option('AutoConLev'); ?>" /></td> 109 </tr> 230 231 <td><input type="checkbox" <?php if (get_option('AutoConLev')==1){ echo 'checked="checked" value="0"'; } else {echo 'value="1"';} ?> name="AutoConLev" /></td> 232 233 </tr> 234 110 235 </table> 236 111 237 238 112 239 <?php submit_button(); ?> 240 113 241 </form> 242 114 243 </div> 115 244 245 246 116 247 <div id="fb-root"></div> 248 117 249 <script>(function(d, s, id) { 250 118 251 var js, fjs = d.getElementsByTagName(s)[0]; 252 119 253 if (d.getElementById(id)) return; 254 120 255 js = d.createElement(s); js.id = id; 256 121 257 js.src = "//connect.facebook.net/nl_NL/sdk.js#xfbml=1&appId=407436179311287&version=v2.0"; 258 122 259 fjs.parentNode.insertBefore(js, fjs); 260 123 261 }(document, 'script', 'facebook-jssdk'));</script> 262 124 263 <div class="fb-like-box" data-href="https://www.facebook.com/hansvaneijsdenphotography" data-colorscheme="light" data-show-faces="false" data-header="false" data-stream="false" data-show-border="false"></div> 264 125 265 <br> 266 126 267 <a href="https://twitter.com/HansVanEijsden" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @HansVanEijsden</a> 268 127 269 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> 128 270 271 272 129 273 <?php 274 130 275 } 131 276 277 278 132 279 function imagick_sharpen_resized_files($resized_file) { 280 133 281 $image = new Imagick($resized_file); 282 134 283 $size = @getimagesize($resized_file); 284 135 285 if (!$size) 286 136 287 return new WP_Error('invalid_image', __('Could not read image size.'), $file); 288 137 289 list($orig_w,$orig_h,$orig_type) = $size; 138 290 291 292 139 293 // We only want to use our sharpening on JPG files 294 140 295 switch($orig_type) { 296 141 297 case IMAGETYPE_JPEG: 142 298 299 300 143 301 // Automatic Contrast Leveling 302 144 303 if (get_option('AutoConLev')==true) { 304 145 305 $image->normalizeImage(); 306 146 307 } 147 308 309 310 148 311 // Sharpen the image (the default is via the Lanczos algorithm) 312 149 313 $image->unsharpMaskImage(get_option('Radius'),get_option('Sigma'),get_option('Sharpening'),get_option('Threshold')); 314 150 315 316 151 317 // Store the JPG file, with as default a compression quality of 92 (default WordPress = 90, default ImageMagick = 85...) 318 152 319 $image->setImageFormat("jpg"); 320 153 321 $image->setImageCompression(Imagick::COMPRESSION_JPEG); 322 154 323 $image->setImageCompressionQuality(get_option('CompressionQuality')); 324 155 325 $image->writeImage($resized_file); 326 156 327 328 157 329 break; 330 158 331 default: 332 159 333 return $resized_file; 334 160 335 } 336 161 337 338 162 339 // Remove the JPG from memory 340 163 341 $image->destroy(); 342 164 343 344 165 345 return $resized_file; 346 166 347 } 348 167 349 350 168 351 add_filter('image_make_intermediate_size','imagick_sharpen_resized_files',900); 352 169 353 register_deactivation_hook( __FILE__,'imagick_sharpen_resized_files_deactivate'); 354 170 355 add_action('admin_init','imagick_sharpen_resized_files_register_settings'); 356 171 357 add_action('admin_menu','imagick_sharpen_resized_files_register_options_page'); 358 -
imagemagick-sharpen-resized-images/trunk/readme.txt
r927867 r930342 6 6 Requires at least: 3.5 7 7 Tested up to: 3.9.1 8 Stable tag: 1.1. 28 Stable tag: 1.1.3 9 9 License: GPL v3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 22 22 == Installation == 23 23 24 1. Upload `imagick-sharpen-resized-images.php` to the `/wp-content/plugins/` directory 24 1. Upload `imagick-sharpen-resized-images.php` to the `/wp-content/plugins/` directory. 25 25 2. Activate the plugin through the 'Plugins' menu in WordPress. 26 26 3. In your Wordpress Settings you'll have a new admin entry: IM Sharpen Images. … … 32 32 = Are there any system requirements? = 33 33 34 Your host needs to have the [imagick PHP module](http://pecl.php.net/package/imagick) installed .35 The plugin has a built-in check.34 Your host needs to have the [imagick PHP module](http://pecl.php.net/package/imagick) installed (and, of course, the [ImageMagick](http://www.imagemagick.org) program itself). 35 The imagick PHP module is NOT a WordPress plugin, but a module for PHP. The plugin has a built-in check for this imagick PHP module. 36 36 37 If you don't have the PHP imagickmodule installed you can still sharpen your images by using the [Sharpen Resized Images](https://wordpress.org/plugins/sharpen-resized-images/) plugin. It sharpens the images by using lower quality GD, so it strips EXIF data and it strips color profiles.37 If you don't have the imagick PHP module installed you can still sharpen your images by using the [Sharpen Resized Images](https://wordpress.org/plugins/sharpen-resized-images/) plugin. It sharpens the images by using lower quality GD, so it strips EXIF data and it strips color profiles. 38 38 39 39 = I don't see any sharpening, why? = 40 40 41 41 * After you enable the plugin it will only sharpen new uploads. If you want to sharpen your already uploaded images you will also need the [Regenerate Thumbnails](http://wordpress.org/plugins/regenerate-thumbnails/) plugin. 42 * Make sure to have not only the PHP module but also the ImageMagick software installed on the server (most servers have it though). 42 43 * Still no differences? Clear your browser cache. 43 44 * If you're using Varnish cache or other server caches, empty them. … … 59 60 60 61 == Changelog == 62 63 = 1.1.3 = 64 * The Automatic Contrast Leveling checkbox bug has been fixed (thanks niwreg!) 61 65 62 66 = 1.1.2 = … … 87 91 88 92 = 1.0 = 89 This fixes the WordPress blurry images problem 90 91 == ToDo == 92 There's one thing I really want to fix: after unchecking the Automatic Contrast Leveling in Settings, it won't turn on again. Plugin needs deactivating and (re)activating to enable it again. 93 This fixes the WordPress blurry images problem.
Note: See TracChangeset
for help on using the changeset viewer.