def composite( self, viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None, ignore_preview=False, ): """ Composite the PSD image. :param viewport: Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the viewbox of the PSD. :param ignore_preview: Boolean flag to whether skip compositing when a pre-composited preview is available. :param force: Boolean flag to force vector drawing. :param color: Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode. :param alpha: Backdrop alpha in [0.0, 1.0]. :param layer_filter: Callable that takes a layer as argument and returns whether if the layer is composited. Default is :py:func:`~psd_tools.api.layers.PixelLayer.is_visible`. :return: :py:class:`PIL.Image`. """ from psd_tools.composite import composite_pil if not (ignore_preview or force) and self.has_preview(): return self.topil() return composite_pil(self, color, alpha, viewport, layer_filter, force)
def composite( self, viewport=None, force=False, color=1.0, alpha=0.0, layer_filter=None ): """ Composite layer and masks (mask, vector mask, and clipping layers). :param viewport: Viewport bounding box specified by (x1, y1, x2, y2) tuple. Default is the layer's bbox. :param force: Boolean flag to force vector drawing. :param color: Backdrop color specified by scalar or tuple of scalar. The color value should be in [0.0, 1.0]. For example, (1., 0., 0.) specifies red in RGB color mode. :param alpha: Backdrop alpha in [0.0, 1.0]. :param layer_filter: Callable that takes a layer as argument and returns whether if the layer is composited. Default is :py:func:`~psd_tools.api.layers.PixelLayer.is_visible`. :return: :py:class:`PIL.Image`. """ from psd_tools.composite import composite_pil return composite_pil( self, color, alpha, viewport, layer_filter, force, as_layer=True )