def enable_alpha(self):
        if self.image_channels < 4:
            with_alpha = cv.CreateImage(
                (self.image.width, self.image.height), self.image_depth, 4
            )
            if self.image_channels == 3:
                cv.CvtColor(self.image, with_alpha, cv.CV_BGR2BGRA)
            else:
                cv.CvtColor(self.image, with_alpha, cv.CV_GRAY2BGRA)
            self.image = with_alpha
dataset/ETHPy150Open thumbor/opencv-engine/opencv_engine/engine.py/Engine.enable_alpha/original