Tuesday, November 19, 2024
Google search engine
HomeLanguagesPHP | Imagick sepiaToneImage() Function

PHP | Imagick sepiaToneImage() Function

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
  
// Create a new imagick object
$imagick = new Imagick(
  
// Apply sepia tone to image
$imagick->sepiaToneImage(20);
  
// Display the image
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>


Output:

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// 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

RELATED ARTICLES

Most Popular

Recent Comments