WordPress is a powerful content management system, but it performs by default in image processingautomatic compressionand cropping. This is helpful for most regular users, but for designers, e-commerce operators, and photobloggers, these automated operations often destroy the original effect of the image.
If you want to preserve the original quality and size of your uploaded images and don't want WordPress to take liberties with them, then this article is for you.
![Images [1] - Completely disable WordPress image compression and cropping to preserve original image quality](https://www.361sale.com/wp-content/uploads/2025/05/20250529143402682-image.png)
First, WordPress default image compression mechanism description
surname Cong WordPress From 4.5 onwards, the system will check all uploaded JPEG Images are automatically compressed with a default compression quality of 82%. In addition, when uploading images, WordPress automatically generates multiple images of different sizes (e.g., thumbnail, medium, large, etc.) for use on different devices.
While this mechanism optimizes page load speed, it may result in blurry images, inaccurate colors, or missing details.
II. Disable JPEG image compression
Add the following code to the theme's functions.php file, you can turn off WordPress' compression of JPEG images:
add_filter('jpeg_quality', function($arg){ return 100; });
This code sets the JPEG compression ratio to 100%, which means no compression.
For WordPress 5.8 and later, add this code together:
add_filter('wp_editor_set_quality', function($quality) {
return 100;
});
This overrides the editor's compression processing when cropping, rotating, and scaling images.
C. Turn off image cropping and automatic generation of multiple sizes
By default, WordPress automatically generates multiple sizes (e.g. 150×150, 300×300, 768x...etc.) every time you upload an image. To avoid the system creating useless images in bulk in the background, you can disable these settings.
Method 1: Disable default size
exist functions.php Add the following code to the file:
function disable_default_image_sizes( $sizes) {
unset( $sizes['thumbnail'] );
unset( $sizes['medium']).
unset( $sizes['large']);
unset( $sizes['medium_large']); unset( $sizes['medium_large']).
unset( $sizes['1536x1536']);
unset( $sizes['2048x2048']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'disable_default_image_sizes');
Method 2: Remove the theme or plugin to customize the size
Some themes or plugins may register additional image sizes. Use the following code to remove them in bulk:
function remove_custom_image_sizes() {
foreach ( get_intermediate_image_sizes() as $size ) {
remove_image_size($size);
}
}
add_action('init', 'remove_custom_image_sizes', 100);
IV. Disable image size in settings
Go to Backstage > Settings > Media and set "thumbnailSize", "Medium Size", and "Large Size" are all set to 0.
![Images [2] - Completely disable WordPress image compression and cropping to preserve the original image quality](https://www.361sale.com/wp-content/uploads/2025/05/20250529143538454-image.png)
This only affects WordPress The core generates image sizes by default that are not valid for themes or plugins, so it is recommended to use them with code.
V. Turn off thumbnail square cropping
WordPress will crop the thumbnail to a square by default. To preserve the original aspect ratio, add the following code:
update_option('thumbnail_crop', 0);
You can also uncheck the "Crop thumbnails to make them square" option in the background media settings.
Six, optional plug-ins recommended
Users who are not familiar with the code can achieve the same purpose with the help of the following plugin:
- Disable Image Sizes: One Click Disable WordPress and theme registered image sizes
- Stop Generating Unnecessary Thumbnails: Stop WordPress from generating redundant images when uploading
- Imsanity: Limit the maximum size of uploaded images to prevent taking up a lot of space
![Images [3] - Completely disable WordPress image compression and cropping to preserve the original image quality](https://www.361sale.com/wp-content/uploads/2025/05/20250529143716556-image.png)
VII. Pre-upload image optimization recommendations
Although turning off compression preserves the quality of the image, it is still recommended to pre-process it with professional tools:
- TinyPNG (online tool)
![Images [4] - Completely disable WordPress image compression and cropping to preserve original image quality](https://www.361sale.com/wp-content/uploads/2025/05/20250529143735641-image.png)
- ImageOptim (Mac)
![Images [5] - Completely disable WordPress image compression and cropping to preserve the original image quality](https://www.361sale.com/wp-content/uploads/2025/05/20250529143811906-image.png)
- RIOT (Windows)
This helps to reduce file size and speed up page loading.
summarize
WordPress The image manipulation feature has its positive aspects, but it can be a distraction for sites seeking image integrity. With the above settings, each image uploaded can be kept in its original state without being tampered with, compressed or cropped.
A few snippets of code and simple settings lead to a more professional image management solution for your site's content.
Link to this article:https://www.361sale.com/en/56702The article is copyrighted and must be reproduced with attribution.




















![Emoji[wozuimei]-Photonflux.com | Professional WordPress repair service, worldwide, rapid response](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![Emoticon[baoquan] - Photon Wave Network | Professional WordPress Repair Services, Worldwide Coverage, Rapid Response](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments