Skip to content

Commit

Permalink
Adapt
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Oct 27, 2024
1 parent f726242 commit 639ba48
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions tests/Unit/HeicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,34 @@
namespace Intervention\Image\Tests\Unit;

use Intervention\Image\Tests\BaseTestCase;
use Intervention\Image\Encoders\MediaTypeEncoder;
use Imagick;
use Intervention\Image\ImageManager;
use ImagickPixel;

final class HeicTest extends BaseTestCase
{
public function testEncoding(): void
{
$manager = ImageManager::imagick();
$input = $manager->create(100, 100)->encode(new MediaTypeEncoder('image/heic'));
// create
$background = new ImagickPixel('rgba(255, 255, 255, 0)');
$imagick = new Imagick();
$imagick->newImage(100, 100, $background, 'png');
$imagick->setType(Imagick::IMGTYPE_UNDEFINED);
$imagick->setImageType(Imagick::IMGTYPE_UNDEFINED);
$imagick->setColorspace(Imagick::COLORSPACE_SRGB);
$imagick->setImageResolution(96, 96);
$imagick->setImageBackgroundColor($background);

// encode
$imagick->setFormat('HEIC');
$imagick->setImageFormat('HEIC');
$imagick->setCompressionQuality(75);
$imagick->setImageCompressionQuality(75);
$encoded = $imagick->getImagesBlob();

// re-read
$imagick = new Imagick();
$imagick->readImageBlob($input->toString());
$imagick->readImageBlob($encoded);

$this->assertInstanceOf(Imagick::class, $imagick);
}
}

0 comments on commit 639ba48

Please sign in to comment.