Open In App

PHP | Imagick sepiaToneImage() Function

Last Updated : 17 Dec, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The Imagick::sepiaToneImage() function is an inbuilt function in PHP which is used to apply a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning. Syntax:
bool Imagick::sepiaToneImage( float $threshold )
Parameters: This function accepts a single parameter $threshold which holds the measure of the extent of the sepia toning. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::sepiaToneImage() function in PHP: Program 1: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');

// Apply sepia tone to image
$imagick->sepiaToneImage(20);

// Display the image
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
Output: Program 2: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');

// Apply sepia tone to image
$imagick->sepiaToneImage(90);

// Display the image
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
Output: Reference: https://www.php.net/manual/en/imagick.sepiatoneimage.php

Similar Reads