image_max_bit_depth
Filters the maximum bit depth of resized images.
This filter only applies when resizing using the Imagick editor since GD does not support getting or setting bit depth.
Use this to adjust the maximum bit depth of resized images.
Usage
add_filter( 'image_max_bit_depth', 'wp_kama_image_max_bit_depth_filter', 10, 2 ); /** * Function for `image_max_bit_depth` filter-hook. * * @param int $max_depth The maximum bit depth. * @param int $image_depth The bit depth of the original image. * * @return int */ function wp_kama_image_max_bit_depth_filter( $max_depth, $image_depth ){ // filter... return $max_depth; }
- $max_depth(int)
- The maximum bit depth.
Default: input depth - $image_depth(int)
- The bit depth of the original image.
Changelog
Since 6.8.0 | Introduced. |
Where the hook is called
image_max_bit_depth
wp-includes/class-wp-image-editor-imagick.php 552
$max_depth = apply_filters( 'image_max_bit_depth', $this->image->getImageDepth(), $this->image->getImageDepth() );