

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to apply a gamma correction to a Graphics Draw (GD) image in PHP?
imagegammacorrect() is an inbuilt function in PHP that is used to apply a gamma correction to a given Graphics Draw (GD) input image and an output gamma.
Syntax
bool imagegammacorrect(resource $image, float $inputgamma, float $outputgamma)
Parameters
imagegammacorrect() takes three different parameters: $image, $inputgamma and $outputgamma.
$image − Specifies the image to be worked.
$inputgamma − Specifies the input gamma.
$outputgamma − Specifies the output gamma.
Return Values
imagegammacorrect() returns True on success and False on failure.
Example 1
<?php // load an image from the local drive folder $img = imagecreatefrompng('C:\xampp\htdocs\Images\img58.png'); // Change the image gamma by using imagegammacorrect imagegammacorrect($img, 15, 1.5); // Output image to the browser header('Content-Type: image/png'); imagepng($img); imagedestroy($img); ?>
Output
Input image before using imagegammacorrect() PHP function
Output image after using imagegammacorrect() PHP function
Explanation − In this example, we loaded the image from the local drive folder by using the imagecreatefrompng() function or we can also use the URL of an image. After that, we applied imagegammacorrect() with the values 5 and 1.5. We can see the difference between the two images in the output.
- Related Questions & Answers
- Draw a line in C++ graphics
- How to apply a filter to an image using imagefilter() function in PHP?
- How to draw a text string image horizontally by using imagestring() function in PHP?
- How to draw a png image on a Python tkinter canvas?
- How to apply a Sepia tone to an image in Node Jimp?
- How can we draw a rounded rectangle using the Graphics object in Java?
- How to draw a line using imageline() function in PHP?
- How to draw text on Image in Android?
- Flood fill to specific color in PHP using imagefilltoborder() (GD) function.
- How to apply Posterize to an image in Node Jimp?
- How to draw a string vertically using imagestringup() function in PHP?
- How to make graphics with a script in HTML?
- How to draw an Image with drawImage() in HTML5?
- How to resize image in PHP?
- How to draw a filled polygon using an imagefilledpolygon() function in PHP?