def convert_file(self):
        try:
            if self.chosenFile is not None:

                palette = self.colorPalette.get()

                if palette in LEGO_PALETTE and palette != 'none':
                    legofy.main(self.chosenFile.name, size=self.brickNumberScale.get(), palette_mode=palette)
                else:
                    legofy.main(self.chosenFile.name, size=self.brickNumberScale.get())

                tkmsg.showinfo("Success!", "Your image has been legofied!")
            else:
                tkmsg.showerror("File not found", "Please select a file before legofying")
        except Exception as e:
            tkmsg.showerror("Error", str(e))
dataset/ETHPy150Open JuanPotato/Legofy/legofy/legofy_gui.py/LegofyGuiMainFrame.convert_file/original