Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagegammacorrect

Description

The imagegammacorrect of Image for PHP apply a gamma correction to a GD image.

Syntax

imagegammacorrect(
    GdImage $image,
    float $input_gamma,
    float $output_gamma
): bool

Parameters

image

A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().

input_gamma

The input gamma.

output_gamma

The output gamma.

Return

Returns true on success or false on failure.

Examples

1 · return

<?

$width = 100;
$height = 100;
$image = imagecreate($width, $height);

$input_gamma = 1.0;
$output_gamma = 1.5;

$return = imagegammacorrect($image, $input_gamma, $output_gamma);

var_export($return);

?>
true

2 · base64

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/gif/1.gif';
$image = imagecreatefromgif($filename);

$input_gamma = 1.0;
$output_gamma = 1.5;
imagegammacorrect($image, $input_gamma, $output_gamma);

ob_start();

    imagegif($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/gif;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/gif;base64,R0lGODdhZABkAIAAABAKEAAAACwAAAAAZABkAAACc4SPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5LL5jE6r1+y2+w2Py+f0uv2Oz+v3/L7/DxgoOEhYaHiImKi4yNjo+AhpWAAAOw==">
</body>
</html>
HomeMenu