downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Imagick::contrastStretchImage> <Imagick::__construct
[edit] Last updated: Wed, 22 May 2013

view this page in

Imagick::contrastImage

(PECL imagick 2.0.0)

Imagick::contrastImageChange the contrast of the image

Descrição

bool Imagick::contrastImage ( bool $sharpen )

Enhances the intensity differences between the lighter and darker elements of the image. Set sharpen to a value other than 0 to increase the image contrast otherwise the contrast is reduced.

Parâmetros

sharpen

The sharpen value

Valor Retornado

Returns TRUE on success.

Erros

Throws ImagickException on error.



add a note add a note User Contributed Notes Imagick::contrastImage - [2 notes]
up
0
xyking
3 years ago
Tip:
<?php
$image
->contrastImage(1); //Increase contrast once
$image->contrastImage(1); //Increase contrast more
$image->contrastImage(1); //Increase contrast even more

$image->contrastImage(0); //Decrease contrast once
$image->contrastImage(0); //Decrease contrast more
$image->contrastImage(0); //Decrease contrast even more

//This could be made into a function like this:
public function contrast($level) {
       
$level = (int)$level;
        if (
$level < -10) {
           
$level = -10;
        } else if (
$level > 10) {
           
$level = 10;
        }
        if (
$level > 0) {
            for (
$i = 0; $i < $level; $i++) {
               
$this->image->contrastImage(1);
            }
        } else if (
$level < 0) {
            for (
$i = $level; $i > 0; $i--) {
               
$this->image->contrastImage(0);
            }
        }
    }
?>
up
0
goekar at msn dot com
5 years ago
<?
$image = new Imagick('test.jpg'); // open image file
$image->contrastImage(9); // 0 - 9
$image->writeImage('test2.jpg'); //save image
?>

 
show source | credits | sitemap | contact | advertising | mirror sites