0

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);
Vinay Kapoor
  • 47
  • 1
  • 10

1 Answers1

0

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]).

jcupitt
  • 10,213
  • 2
  • 23
  • 39