public function mergeAlpha(
        Image $srcImage,
        $dstX,
        $dstY,
        $alpha = 127
    ) {
        if (!is_resource($this->image) || !is_resource($srcImage->image)) {
            throw new \RuntimeException(
                'Attempt to merge image data using an invalid image resource.'
            );
        }

        $percent = 100 - min(max(round(($alpha / 127 * 100)), 1), 100);

        // copy images around
        @imagecopymerge(
            $this->image,
            $srcImage->image,
            (int)$dstX,
            (int)$dstY,
            0,
            0,
            $srcImage->width,
            $srcImage->height,
            $percent
        );

        return $this;
    }