Imagick::resetImagePage()函數是PHP中的內置函數,用於重置圖像頁麵。
用法:
bool Imagick::resetImagePage( string $page )
參數:該函數接受單個參數$page,該參數以WxH + x + y的形式保存頁麵定義,其中W表示寬度,H表示高度,x表示x坐標,y表示y坐標。
返回值:成功時此函數返回TRUE。
異常:該函數在錯誤時引發ImagickException。
以下示例程序旨在說明PHP中的Imagick::resetImagePage()函數:
程序1:
<?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>");
?>輸出:
Array
(
[width] => 768
[height] => 147
[x] => 2
[y] => 2
)
程序2:
<?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>");
?>輸出:
Array
(
[width] => 800
[height] => 300
[x] => 1
[y] => 1
)
參考: https://www.php.net/manual/en/imagick.resetimagepage.php
相關用法
- PHP Imagick distortImage()用法及代碼示例
- PHP Imagick readImage()用法及代碼示例
- PHP Imagick readImageFile()用法及代碼示例
- PHP Imagick remapImage()用法及代碼示例
- PHP Imagick readImages()用法及代碼示例
- PHP Imagick extentImage()用法及代碼示例
- PHP Imagick despeckleImage()用法及代碼示例
- PHP Imagick separateImageChannel()用法及代碼示例
- PHP Imagick sepiaToneImage()用法及代碼示例
- PHP Imagick setColorspace()用法及代碼示例
- PHP Imagick convolveImage()用法及代碼示例
- PHP Imagick getCopyright()用法及代碼示例
- PHP Imagick gaussianBlurImage()用法及代碼示例
- PHP Imagick enhanceImage()用法及代碼示例
- PHP Imagick encipherImage()用法及代碼示例
注:本文由純淨天空篩選整理自gurrrung大神的英文原創作品 PHP | Imagick resetImagePage() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
