mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 20:28:21 +01:00
added gamma method
This commit is contained in:
parent
207010c76f
commit
4956f25b68
@ -1365,6 +1365,20 @@ class Image
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies gamma correction
|
||||
*
|
||||
* @param float $input
|
||||
* @param float $output
|
||||
* @return Image
|
||||
*/
|
||||
public function gamma($input, $output)
|
||||
{
|
||||
imagegammacorrect($this->resource, $input, $output);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset to original image resource
|
||||
*
|
||||
|
@ -1400,6 +1400,17 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals(( ord($contents[28]) != '0' ), false);
|
||||
}
|
||||
|
||||
public function testGammaImage()
|
||||
{
|
||||
$img = Image::make('public/tile.png');
|
||||
$img->gamma(1.0, 1.6);
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||
$color1 = $img->pickColor(0, 0, 'hex');
|
||||
$color2 = $img->pickColor(10, 10, 'hex');
|
||||
$this->assertEquals('#cdeb00', $color1);
|
||||
$this->assertEquals('#707d8a', $color2);
|
||||
}
|
||||
|
||||
public function testSaveImage()
|
||||
{
|
||||
$save_as = 'public/test2.jpg';
|
||||
|
Loading…
x
Reference in New Issue
Block a user