Imagick::autoLevelImage


wizard apg

ADJUSTS the levels of a particular image channel by scaling the minimum and maximum values to the full quantum range.



<?php

bool 
public Imagick::autoLevelImage(int $channel Imagick::CHANNEL_DEFAULT);
                                            
?>

$channel


The is one of the Imagick::CHANNEL_* constants.

By default imagick::CHANNEL_DEFAULT.





This function returns true on success.



AVAILABLE "imagick" CHANNEL
STUDIED IN THIS TUTORIAL

1690 - ImageMagick 6.9.10-6
CHANNEL
CONSTANTVALUEABOUT
imagick::CHANNEL_UNDEFINED0 
imagick::CHANNEL_RED1 
imagick::CHANNEL_GRAY1 
imagick::CHANNEL_CYAN1 
imagick::CHANNEL_GREEN2 
imagick::CHANNEL_MAGENTA2 
imagick::CHANNEL_BLUE4 
imagick::CHANNEL_YELLOW4 
imagick::CHANNEL_ALPHA8 
imagick::CHANNEL_OPACITY8 
imagick::CHANNEL_MATTE 8  
imagick::CHANNEL_BLACK32 
imagick::CHANNEL_INDEX32 
imagick::CHANNEL_ALL134217727 
imagick::CHANNEL_DEFAULT134217719 
ed48

  1 EXERCISE   

<?php

    
// Run several times
    
    
$imagePath 'img/gif/E 01 01.gif';
    
    
$str1img 'img/results/autoL611.gif';
    
    
$image1 = new Imagick(realpath($imagePath));
    
$image1->autoLevelImage(Imagick::CHANNEL_DEFAULT);

    
$image1->setimageFormat('gif');

$image1 $image1->getimageBlob();
  
$img imagecreatefromstring($image1);

imagegif($img$str1img);

echo 
basename($str1img); ?>
<br><br>
<img src="<?php echo $str1img?>"
 alt="<?php echo $str1img?>
 title="<?php echo $str1img?>">

 RESULT   

autoLevelImage(Imagick::CHANNEL_GRAY)

autoL611.gif

img/results/autoL611.gif apr

  2 EXERCISE   

<?php

    
// Run several times
    
    
$imagePath 'img/jpg/wizardn.jpg';
    
    
$str2img 'img/results/autoL612.jpg';
    
    
$image2 = new Imagick(realpath($imagePath));
    
$image2->autoLevelImage(Imagick::CHANNEL_DEFAULT);

    
$image2->setimageFormat('jpg');

$image2 $image2->getimageBlob();
  
$img imagecreatefromstring($image2);

imagejpg($img$str2img);

echo 
basename($str2img); ?>
<br><br>
<img src="<?php echo $str2img?>"
 alt="<?php echo $str2img?>
 title="<?php echo $str2img?>">

autoLevelImage(Imagick::CHANNEL_ALPHA)

autoL612.jpg

img/results/autoL612.jpg apr

  3 EXERCISE   

<?php

    
// Run several times
    
    
$imagePath 'img/png/E 01 01.png';
    
    
$str3img 'img/results/autoL613.png';
    
    
$image3 = new Imagick(realpath($imagePath));
    
$image3->autoLevelImage(Imagick::CHANNEL_DEFAULT);

    
$image3->setimageFormat('png');

$image3 $image3->getimageBlob();
  
$img imagecreatefromstring($image3);

imagepng($img$str3img);

echo 
basename($str3img); ?>
<br><br>
<img src="<?php echo $str3img?>"
 alt="<?php echo $str3img?>
 title="<?php echo $str3img?>">

autoLevelImage(Imagick::CHANNEL_BLACK)

autoL613.png

img/results/autoL613.png apr