Change language

PHP Imagick setResolution () function

Syntax:
bool Imagick::setResolution (float $x_resolution, float  $y_resolution)
Parameters:This function takes two parameters as above and described below:
  • $x_resolution: specifies the horizontal resolution.
  • $y_resolution:specifies the vertical resolution.
Return value: this function returns TRUE on success.Exceptions:this function throws an ImagickException on error.The following programs illustrate the Imagick::setResolution function()in PHP:Program 1:  
// Create a new imagick object $imagick = new Imagick();  
// Set permission $imagick -> setResolution (18, 13);  
// Create new image $imagick -> newimage (100, 100, ’none’ );  
// Read image properties print ( "
" . print_r (  $imagick  -> identifyImage(), true).  "
" ); ?>
Output: Array
(
[imageName] = >
[mimetype] = > image / x-
[units] = > Undefined
[type] = > Bilevel
[colorSpace] = > sRGB
[compression] = > Undefined
[fileSize] = > 0B
[geometry] = > Array
(
[width] = > 100
[height] = > 100
)
// you can see the temporary resolution here
[resolution] = > Array
(
[x] = > 18
[y] = > 13
)[signature ] = > e7e2dcff542de95352682dc186432e98f0188084896773f1973276b0577d5305
) Program 2:  
// Create a new imagick object $imagick =
new Imagick();  
// Set permission $imagick -> setResolution (10, 10);  
// Reading the image $imagick -> readimage ( https://media.engineerforengineer.org/wp-content /uploads/engineerforengineer-13.png );  
// Read image properties print ( "
" . print_r (  $imagick  -> identifyImage(), true).  "
" ); ?>
Output:
Array
(
[imageName] = >
[mimetype] = > image / png
[format] = > PNG (Portable Network Graphics)
[units] = > PixelsPerCentimeter
[type] = > TrueColorAlpha
[colorSpace] = > sRGB
[compression] = > Zip
[fileSize] = > 45.4KB
[geometry] = > Array
(
[width] = > 667
[height] = > 184
)
// Here resolution is changed because new image is read
[resolution] = > Array
(
[x] = > 37.8
[y] = > 37.8
)[signature] = > f64054f5bcb4cfb82c6126eff6d3d4e6be7d0e72d5620033442cecb4b9feabbd
) Link a:= : //www.php.net/manual/en/imagick.setresolution.php> https://www.php.net/manual/en/imagick.setresolution.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method