Wednesday, September 17, 2025
HomeLanguagesPHP | Imagick encipherImage() Function

PHP | Imagick encipherImage() Function

The Imagick::encipherImage() function is an inbuilt function in PHP which is used to convert plain pixels image into enciphered pixels. This function simply converts the pixels to enciphered pixels and then the image can be readable only if decipher the image with the same string with which it was enciphered.

Syntax:

bool Imagick::encipherImage( $passphrase )

Parameters: This function accepts single parameter $passphrase which holds the passphrase value.

Return Value: It returns True on success or False on failure.

Below program illustrates the Imagick::encipherImage() function in PHP:

Program:




<?php
  
// Creating new Imagick object
$image = new Imagick(
  
// Creating the passphrase
$passphrase = "neveropen";
  
// Calling the function
$image->encipherImage($passphrase);
  
// $image is now enciphered with string
// "neveropen"
// $image can only be made readable by 
// decipherImage() method
// with the same passphrase as parameter
  
header("Content-Type: image/jpg"); 
  
// Showing the deciphered image which is
// same as our sampleimage.jpeg
echo $image;
  
?>


Output:
Deciphered image if the passphrase is incorrect :

Reference: https://php.net/manual/en/imagick.encipherimage.php

RELATED ARTICLES

Most Popular

Dominic
32299 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6660 POSTS0 COMMENTS
Nicole Veronica
11833 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11895 POSTS0 COMMENTS
Shaida Kate Naidoo
6779 POSTS0 COMMENTS
Ted Musemwa
7050 POSTS0 COMMENTS
Thapelo Manthata
6735 POSTS0 COMMENTS
Umr Jansen
6741 POSTS0 COMMENTS