Open In App

PHP | Imagick resetImagePage() Function

Last Updated : 17 Dec, 2019
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
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
<?php

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

// 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
<?php

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

// 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

Similar Reads