protected function addOpacityFilter()
    {
        $opacity = Utils::fixPNGOpacity($this->opacity);

        if ($opacity >= 0 && $opacity < 127) {
            imagealphablending($this->resource, false);
            imagefilter($this->resource, IMG_FILTER_COLORIZE, 0, 0, 0, $opacity);
        }
    }