- PHP ImageMagick Tutorial
- PHP ImageMagick - Home
- PHP ImageMagick - Introduction
- Background Color
- Image Reflections
- Image Cropping
- Image Bordering
- Image Resizing
- Composite Images
- Contrast & Brightness
- Enhancing &Equalizing
- Sharpening & Blurring
- Image Tiling
- Image Threshold
- Modifying Colors
- Different effects
- Securing The Images
- Simulation Of Sketches
- Editing TheAppearance
- Rotation and Rolling
- Splicing & Spreading
- Miscellaneous Functions
- PHP ImageMagick Useful Resources
- PHP ImageMagick - Quick Guide
- PHP ImageMagick - Resources
- PHP ImageMagick - Discussion
PHP ImageMagick - Enhancing & Equalizing
Enhancing Images
Image enhancement is the process of improving the visual appearance or quality of an image. This can be achieved through a variety of techniques, such as adjusting brightness and contrast, color balancing, sharpening or blurring edges, changing resolution and noise removal.
There is a function provided by Imagemagick which is ‘enhanceImage()’. It takes the image as input and enhances the image by improving its quality and produces the enhanced image as output.
Syntax
public Imagick::enhanceImage(): bool
This function has no parameters.
Example
This example represents the PHP code to implement the function ‘enhanceImage()’. The new imagick is created at first, then ‘enhanceImage()’, function is applied and output is obtained in the format ‘enhanceImage.png’.
<?php $image=new Imagick($_SERVER['DOCUMENT_ROOT']."/test/image.jpeg"); $image->enhanceImage(); $image->writeImage($_SERVER['DOCUMENT_ROOT']."/test/enhanceImage.png"); ?>
Assume that the following is the input image (image.jpg) in the program −
Output
Equalizing images
Equalizing images is a process of adjusting the contrast and brightness in an image to make it look more balanced. Equalizing can help bring out details in shadows and highlights, as well as improve color accuracy and reduce noise.
In this process, the contrast can either be increased or decreased based on the histogram equalization which is a computer image processing technique. In this section, you will be learning to equalize an image using the ‘equalizeImage()’ function provided by Imagemagick.
Syntax
public Imagick::equalizeImage(): bool
This function has no parameters. It takes an image as input and produces the equalized image as output.
Example
This example shows the implementation of ‘equalizeImage()’ function in PHP. The input image is read after creation of imagick object and then ‘equalizeImage()’ function is applied on that input image. The final output image is obtained in the format ‘equalizeImage.png’.
<?php $image=new Imagick($_SERVER['DOCUMENT_ROOT']."/test/image.jpeg"); $image->equalizeImage(); $image->writeImage($_SERVER['DOCUMENT_ROOT']."/test/equalizeImage.png"); ?>
Assume that the following is the input image (image.jpeg) in the program −
To Continue Learning Please Login
Login with Google