Reputation: 77
I am using libvips php library i want to merge image layers using libvips. Does any method in libvips for merge the image layers like imagick has as below
$img = $img->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
Upvotes: 0
Views: 648
Reputation: 11190
You can use ->flatten()
to squash the alpha out of an image. Docs here:
https://libvips.github.io/php-vips/docs/classes/Jcupitt.Vips.ImageAutodoc.html#method_flatten
Unfortunately, phpdoc doesn't let you document optional arguments, so you need to refer to the C docs to see the extra controls:
https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-flatten
You can remove bands with unset
, so you can drop alpha from an RGBA image with eg. unset($image[3])
.
Upvotes: 0