Images uploaded on my WordPress website are too heavily compressed. I found out that WordPress automatically compresses images and you can change that with a filter:

add_filter( 'jpeg_quality', function($arg) { return 100; });
add_filter( 'wp_editor_set_quality', function($arg) { return 100; });

But this doesn't fix my problem. Different image sizes are still compressed.

Full size: good quality

Medium size: bad quality

Can someone help me fix this problem? Thanks!

  • What makes you say the 2nd image is too heavily compressed? Loss of detail is unavoidable when resizing, and I don't see any JPEG artefacts. Commented Mar 15, 2018 at 14:16
  • In my opinion this is way too much loss of detail.
    – T94
    Commented Mar 15, 2018 at 14:25
  • Why would WP go back and recompress all the original images? The filters apply to images when they upload, images already in the system won't be impacted unless you reupload them, you should look into a plugin for thumbnail regeneration
    – Tom J Nowell
    Commented Mar 15, 2018 at 14:40

1 Answer 1


Need both:

add_filter('jpeg_quality', function($arg){return 100;});

add_filter( 'wp_editor_set_quality', function($arg){return 100;} );

  • Tried this, didn't help :(
    – T94
    Commented Mar 15, 2018 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.