mirror of
https://github.com/Intervention/image.git
synced 2025-08-07 14:26:31 +02:00
added gamma method
This commit is contained in:
@@ -1365,6 +1365,20 @@ class Image
|
|||||||
return $this;
|
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
|
* Reset to original image resource
|
||||||
*
|
*
|
||||||
|
@@ -1400,6 +1400,17 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
|||||||
$this->assertEquals(( ord($contents[28]) != '0' ), false);
|
$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()
|
public function testSaveImage()
|
||||||
{
|
{
|
||||||
$save_as = 'public/test2.jpg';
|
$save_as = 'public/test2.jpg';
|
||||||
|
Reference in New Issue
Block a user