Open In App

PHP | Imagick resetImagePage() Function

Improve
Improve
Like Article
Like
Save
Share
Report

The Imagick::resetImagePage() function is an inbuilt function in PHP which is used to reset the image page.

Syntax:

bool Imagick::resetImagePage( string $page )

Parameters: This function accepts a single parameter $page which holds the page definition in form of WxH+x+y, where W is for width, H is for height, x is for x-coordinate and y is for y-coordinate.

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.

Below programs illustrate the Imagick::resetImagePage() function in PHP:

Program 1:




<?php
  
// Create a new Imagick object
$imagick = new Imagick(
  
// Reset the Image Page
$imagick->resetImagePage('768x147+2+2');
  
// Get the Image Page
$page = $imagick->getImagePage();
print("<pre>".print_r($page, true)."</pre>");
?>


Output:

Array
(
    [width] => 768
    [height] => 147
    [x] => 2
    [y] => 2
)

Program 2:




<?php
  
// Create a new Imagick object
$imagick = new Imagick(
  
// Reset the Image Page
$imagick->resetImagePage('800x300+1+1');
  
// Get the Image Page
$page = $imagick->getImagePage();
print("<pre>".print_r($page, true)."</pre>");
?>


Output:

Array
(
    [width] => 800
    [height] => 300
    [x] => 1
    [y] => 1
)

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



Last Updated : 17 Dec, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads