create 8-bit png instead of 16-bit

This commit is contained in:
Uwe Steinmann 2023-03-11 18:59:02 +01:00
parent 2e818d5426
commit da992a7bdd

View File

@ -66,6 +66,11 @@ class SeedDMS_ConversionServicePdfToImage extends SeedDMS_ConversionServiceBase
$imagick->scaleImage(min((int) $params['width'], $imagick->getImageWidth()), 0);
/* Remove alpha channel and set to white */
$imagick->setImageBackgroundColor('white');
/* Setting the color-type and bit-depth produces much smaller images
* because the default depth appears to be 16 bit
*/
$imagick->setOption('png:color-type', 6);
$imagick->setOption('png:bit-depth', 8);
$imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE);
$imagick->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
$imagick->setImageFormat('png');