Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e56ca6e63 |
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: H4B Image Optim
|
||||
* Plugin URI: https://gitea.help4bis.com/help4bis/h4b-image-optim
|
||||
* Description: ICC-safe image optimisation with WebP + AVIF generation. Replaces Smush Pro without the grey-wash bug. No CDN.
|
||||
* Version: 0.2.2
|
||||
* Version: 0.2.3
|
||||
* Author: help4bis (Henk + Claude)
|
||||
* Author URI: https://help4bis.com
|
||||
* License: GPL-2.0-or-later
|
||||
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'H4B_IMG_OPTIM_VERSION', '0.2.2' );
|
||||
define( 'H4B_IMG_OPTIM_VERSION', '0.2.3' );
|
||||
define( 'H4B_IMG_OPTIM_FILE', __FILE__ );
|
||||
define( 'H4B_IMG_OPTIM_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'H4B_IMG_OPTIM_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
@@ -229,8 +229,14 @@ final class Format_Generator {
|
||||
$dest = $source . '.avif';
|
||||
$tmp = $dest . '.h4b.tmp';
|
||||
|
||||
// --min / --max set quality range.
|
||||
// -s sets encoder speed (0-10; we default to 6 = balanced).
|
||||
// -y 444 forces 4:4:4 chroma subsampling — preserves luminance of near-white
|
||||
// pixels exactly, otherwise avifenc rounds white-ish pixels darker (~2% shift)
|
||||
// which creates a visible grey halo against pure-white page backgrounds.
|
||||
// Tradeoff: ~5% larger AVIF files in exchange for true colour fidelity.
|
||||
$cmd = sprintf(
|
||||
'%s --min %d --max %d -s %d %s %s 2>&1',
|
||||
'%s --min %d --max %d -s %d -y 444 %s %s 2>&1',
|
||||
escapeshellcmd( $bin ),
|
||||
$qmin,
|
||||
$qmax,
|
||||
|
||||
@@ -33,7 +33,7 @@ final class Settings {
|
||||
// Format generation
|
||||
'generate_webp' => true,
|
||||
'generate_avif' => true, // design decision 1: on by default everywhere
|
||||
'webp_quality' => 80,
|
||||
'webp_quality' => 90, // matches source JPG luminance for B&W ink on white
|
||||
'avif_quality' => 65, // ≈ JPEG q=85 visually
|
||||
'avif_speed' => 6, // 0-10; 6 is balanced
|
||||
'avif_async' => true, // background WP-Cron so upload UI is responsive
|
||||
|
||||
Reference in New Issue
Block a user