Friday, October 17, 2025
HomeLanguagesPHP | Imagick setSizeOffset() Function

PHP | Imagick setSizeOffset() Function

The Imagick::setSizeOffset() function is an inbuilt function in PHP which is used to set the size and offset of the Imagick object.

Syntax:

bool Imagick::setSizeOffset( int $columns, int $rows, int $offset )

Parameters: This function accepts three parameters as mentioned above and described below:

  • $columns: It specifies the width in pixels.
  • $rows: It specifies the height in pixels.
  • $offset: It specifies the image offset.

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.

Below given programs illustrate the Imagick::setSizeOffset() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Set the size offset
$imagick->setSizeOffset(100, 400, 35);
  
// Get the size offset
$sizeOffset = $imagick->getSizeOffset();
echo $sizeOffset;
?>


Output:

35

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Set the size offset
$imagick->setSizeOffset(300, 800, 21);
  
// Get the size offset
$sizeOffset = $imagick->getSizeOffset();
echo $sizeOffset;
?>


Output:

21

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

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS