protected function applyBackgroundTransparency($file, $width, $height)
    {       
        imagealphablending($file, false);
        imagesavealpha($file, true);
        imagefilledrectangle($file, 0, 0, $width, $height, $this->transparentBackground($file));
    }