3

Wordpress keeps applying some kind of compression during uploads to my images thereby compromising with the quality. Where do i deactivate this functionality. I have already tried ..

function add_image_size( $name, $width = 0, $height = 0, $crop = false ) 

but hasnt helped so far. Also tried

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

but both havent helped so far. Any ideas ??

john zuh
  • 59
  • 1
  • 11
  • Have you tried: `add_filter( 'wp_editor_set_quality', function($arg){return 100;} );`. The editor can have different compression settings than published content. – Abstract Jun 24 '18 at 00:06
  • @Jon Appreciate the suggestion. I did try the code . I ended up having to use a plugin with all filter disabling functionality built into it. – john zuh Jun 24 '18 at 22:49
  • @johnzuh What plugin did you end up using? I'm having the same problem as your original question, would love to know what worked for you. – CodeBlind Oct 26 '18 at 04:03
  • @CodeBlind search for (Disable JPEG Compression) plugin by Yonatan Ganot. That did the trick. – john zuh Oct 28 '18 at 17:23
  • @CodeBlind https://wordpress.org/plugins/disable-jpeg-compression/ – john zuh Oct 28 '18 at 19:56
  • I tried that, among a few others, but it didn't work for me. I did find a different solution which I will post as an answer. – CodeBlind Oct 29 '18 at 17:01

1 Answers1

1

I had the same issue with images on my WordPress site being compressed to the point that the jpeg artifacts made most of my images unusable (I'm a photographer, so I can't deal with artifacts like most WordPress users probably can). What ended up doing the trick for me was disabling the "Image Performance" option in Jetpack from the Admin Dashboard (meaning, WordPress wasn't compressing my images on upload, per se, but the end effect was the same). Here's a screenshot:

From what I understand, this option speeds up the load times of your images in two ways; A) it hosts them on a cloud of servers that allow images to be served closer to the clients that request them and B) it uses lossy compression to drastically reduce file sizes.

On my site, I host a gallery of thumbnail images which link to high-res versions. With the "Image Performance" option turned on, notice how the image is hosted by a different server altogether and that there are lots of compression artifacts in it, especially in the sky gradients of the image.

After turning "Image Performance" off, the full-size image is now served directly by my hosting service and the compression artifacts are gone.

Additional Thoughts

For my particular case, WordPress wasn't actually compressing the original uploaded images, it was re-uploading them to the servers that Jetpack uses when you have the "Image Performance" option turned on, where they were then further compressed. This may not be exactly what's happening in the OP's case, but because I initially assumed WordPress was compressing my images on upload as well, I believe this answer is relevant to the question.

CodeBlind
  • 4,519
  • 1
  • 24
  • 36
  • I will simply mark this as an answer. Just in case someone encounters the same problem they could be able to check out the two solutions they might probably fall on one as a solution. – john zuh Oct 29 '18 at 21:02