ContrastCommand.php 466 B

12345678910111213141516171819
  1. <?php
  2. namespace Intervention\Image\Gd\Commands;
  3. class ContrastCommand extends \Intervention\Image\Commands\AbstractCommand
  4. {
  5. /**
  6. * Changes contrast of image
  7. *
  8. * @param \Intervention\Image\Image $image
  9. * @return boolean
  10. */
  11. public function execute($image)
  12. {
  13. $level = $this->argument(0)->between(-100, 100)->required()->value();
  14. return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1));
  15. }
  16. }