PHP/Graphics Image/imagefilter

Материал из Web эксперт
Перейти к: навигация, поиск

IMG_FILTER_COLORIZE

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_COLORIZE, 100, 0, 100);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>



IMG_FILTER_CONTRAST

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_CONTRAST, 20);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>



IMG_FILTER_EDGEDETECT and IMG_FILTER_EMBOSS filters

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_EDGEDETECT);
    imagefilter($image, IMG_FILTER_EMBOSS);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>



IMG_FILTER_GAUSSIAN_BLUR and IMG_FILTER_SELECTIVE_BLUR

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);
    imagefilter($image, IMG_FILTER_SELECTIVE_BLUR);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>



IMG_FILTER_GRAYSCALE and IMG_FILTER_NEGATE

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_GRAYSCALE);
    imagefilter($image, IMG_FILTER_NEGATE);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>



smooths the picture just a little

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_SMOOTH, 6);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>



Special Effects Using imagefilter( ): lighten picture just a little:

 
<?php
    $image = imagecreatefrompng("space.png");
    imagefilter($image, IMG_FILTER_BRIGHTNESS, 50);
    header("content-type: image/png");
    imagepng($image);
    imagedestroy($image);
?>