WordPress at a glance
function is not described

WP_Image_Editor_Imagick::set_quality() public WP 3.5.0

Sets Image Compression quality on a 1-100% scale.

{} It's a method of the class: WP_Image_Editor_Imagick{}

No Hooks.

Return

true|WP_Error. True if set successfully; WP_Error on failure.

Usage

$WP_Image_Editor_Imagick = new WP_Image_Editor_Imagick();
$WP_Image_Editor_Imagick->set_quality( $quality );
$quality(int)
Compression Quality. Range: [1,100]

Changelog

Since 3.5.0 Introduced.

Code of WP_Image_Editor_Imagick::set_quality() WP 5.7.2

<?php
public function set_quality( $quality = null ) {
	$quality_result = parent::set_quality( $quality );
	if ( is_wp_error( $quality_result ) ) {
		return $quality_result;
	} else {
		$quality = $this->get_quality();
	}

	try {
		if ( 'image/jpeg' === $this->mime_type ) {
			$this->image->setImageCompressionQuality( $quality );
			$this->image->setImageCompression( imagick::COMPRESSION_JPEG );
		} else {
			$this->image->setImageCompressionQuality( $quality );
		}
	} catch ( Exception $e ) {
		return new WP_Error( 'image_quality_error', $e->getMessage() );
	}

	return true;
}