-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compression quality toggle #1698
Comments
@westonruter We could add new settings to the Should we add a toggle |
There is a filter for this actually: // Use a quality setting of 75 for AVIF images.
function filter_avif_quality( $quality, $mime_type ) {
if ( 'image/avif' === $mime_type ) {
return 75;
}
return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_avif_quality', 10, 2 ); See the dev note from @adamsilverstein. |
@westonruter does this pertain to either format - avif or webp? |
@sweetrobot I believe you can filter WebP similarly: function filter_webp_quality( $quality, $mime_type ) {
if ( 'image/webp' === $mime_type ) {
return 75;
}
return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_webp_quality', 10, 2 ); |
Interesting - the default quality settings are actually pretty high already so I am a bit surprised to hear that. If possible, I would love to see some before/after images where this is happening. ie if you can, please provide a sample image and the webp / avif versions that look poor to you. As @westonruter pointed out above, compression quality is already adjustable via filters so adding UI controls for them isn't a high priority (although I am not fundamentally opposed to adding them in the plugin). Also note that starting WordPress 6.8, the filter will include size values so quality can be set on a per-size basis. See https://core.trac.wordpress.org/ticket/54648. |
@adamsilverstein please see following for comparisons. focus especially on the wooden frame, at 100% of course.
in cases such as ours, fine texture details are key, and the current default setting of 82 is too aggressive |
Even with downloading the original video file for viewing with the highest quality, the difference between the two is not fully noticeable to me. I mean, I see a difference but not really a difference in quality. The WebP version seems to have less noise, which I wouldn't say is worse. This is all subjective though. |
@westonruter refer to the photos - swapping back and forth repeatedly, and focus on the grain (wood, rather than noise). much detail become smeared and lost entirely. i only brought it up because i noticed the quality difference - this is without looking for it in the first place. it just hit me, because it was noticeable to me, even without the immediate back and forth flickering to compare. i understand subjectivity plays a role, to a degree, but believe this is more than that. |
Feature Description
there should be a compression quality setting - perhaps walled being an "advanced" mode toggle, or some override via a hook in functions or something -sure that's possible currently, though i'm a novice in this regard.
this was prompted because the current compression on webp (and even far more on avif) is overly agressive, and, in our use case compromises too much detail (grainy textures become soft and blurry).
The text was updated successfully, but these errors were encountered: