Optimizing images for use on the web can significantly reduce page load times for image-heavy websites. What many people don’t realize is that WordPress automatically applies a 90% quality level to all JPEG images. This helps to conserve disk space and reduce bandwidth. However, if you are optimizing your images before you upload them, you probably don’t want WordPress to reduce the quality of your images any further.
Remove Automatic JPEG Compression
Here is how you can ensure that WordPress doesn’t reduce the quality of uploaded images:
add_filter( 'jpeg_quality', function () {
return 100;
} );
WordPress Image Optimization Plugins
I’d also recommend you take a look at a few WordPress plugins that can help you optimize images if you aren’t taking care of that before you upload: