Support » Plugin: WP Resized Image Quality » Does 100% mean, there is no compression?

  • Resolved Robnonstop


    Just to be certain, does a 100% setting have the same effect as adding

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

    to the Theme’s function.php? Or is there a difference?

    Is the file re-saved or passed on the way it is? I’m asking because even at a maximum quality setting, a JPEG will degrade with each saving.

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mike Bijon


    Hey @Robononstop, your code example is exactly correct. RIQ just sets the value passed to the JPEG quality filters.

    And the 100% quality options are re-saved. That’s the default a big negative to how WordPress handles JPEGs.

    Good idea to skip the save though. We’d have to unhook the re-save, and I’ve added an issue to the plugin’s repo for doing just that:

    Plugin Author Mike Bijon


    There isn’t currently a way to stop WordPress from compressing JPEGs at the “100%” level.

    Based on the instances of this ‘$quality’ variable, the compression always happens:

    It would be nice to see WP either skip the compression if quality is 100%, or to have an added hook that would let us detect & skip the re-save action based on $quality.

    Not sure what you mean but 100% is the highest quality WordPress can pass. It will mean that GD you a higher quality. Maybe with Imagick it can be wrong for JPG and I will check that next week

    Plugin Author Mike Bijon


    Hi Marko, I’ll try to explain 100% JPEG compression better:

    * All JPEG images are run through a process that breaks them up into squares of pixels (8×8, 16×16, varies based on quality) and then uses an algorithm to convert each set of pixels from pixel/spatial data into transform/frequency data.

    * Converting from pixels to transform info discards some info. Even at 100% quality info is discarded.


    * Each time a JPEG is re-saved, even at 100%, it’s treated as pixel data & re-converted to a transform block-by-block. Thus, more info is discarded each time a 100% JPEG is re-saved.

    So, 100% isn’t just the best quality that WordPress can generate, it’s the highest that the JPEG format can manage. And each time something is saved at 100% it gets worse. That’s the concern here.

    As for PNG, WordPress doesn’t currently have any code in core for compressing PNGs. There are some libraries that handle PNG compression if you want to install them on your server. I discussed them in this support thread last year:

    I wrote a part of the code behind WP_Image_Editor so I do know how compression works. You blamed WordPress on the compression and not JPEG itself. Thats why I commented.

    Also WordPress can handle changing the quality of PNGs but only when you are using Imagick. With GD there is a ticket for that but it’s not in yet.

    Plugin Author Mike Bijon


    Gotcha. Thanks for building what’s there. Guess I should read more of the Imagick detection code. I could probably wrap that to detect & maybe-enable PNG compression in RIQ.

    I tend to generalize in answers on these forums. No blame on WordPress … just easier & faster than being 100% complete & specific.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Does 100% mean, there is no compression?’ is closed to new replies.