Last active
August 29, 2015 14:17
-
-
Save pthiers/b424eab9e43b11e6d00c to your computer and use it in GitHub Desktop.
Imagick: tiff to PNG8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-type: image/png'); | |
$image = "/var/www/html/images/image.TIFF"; | |
$im = new Imagick($image); | |
// resize by 500 width and keep the ratio | |
$im->thumbnailImage(500, 0); | |
//Set new image format 'PNG8' | |
$im->setImageFormat("PNG8"); | |
//Get the min colors of the image. | |
$colors =min(255,$im->getImageColors()); | |
$im->quantizeImage($colors,Imagick::COLORSPACE_RGB,0,false,false); | |
$im->setImageDepth(8); | |
echo $im; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment