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

PHP | Imagick setImage() Function

The Imagick::setImage() function is an inbuilt function in PHP which is used to replace an image in the object.

Syntax:

bool Imagick::setImage( Imagick $replace )

Parameters: This function accepts single parameter $replace which holds an Imagick object.

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.

Below program illustrates the Imagick::setImage() function in PHP:

Program:




<?php
  
// Create two Imagick objects
$imagick_source = new Imagick(
  
$imagick_replace= new Imagick(
  
// Replacing neveropen24.png with colorize1.png
$imagick_source->setImage($imagick_replace);
  
// Display the output image
header('Content-type: image/jpeg');
  
echo $imagick_source;
?>


Output:

Reference: https://www.php.net/manual/en/imagick.setimage.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments