def convert_to_grayscale(self, update_image=True, alpha=True):
    if (('A' in self.image.mode) and alpha):
        image = self.image.convert('LA')
    else:
        image = self.image.convert('L')
    if update_image:
        self.image = image
    return image
def convert_to_grayscale(self, update_image=True, alpha=True):
    if (('A' in self.image.mode) and alpha):
        image = self.image.convert('LA')
    else:
        image = self.image.convert('L')
    if update_image:
        self.image = image
    return image