-2

I'm try to use Converter class to convert my image file but when I'm use it in OOP it's give me

TypeError: convertDocument() takes 1 positional argument but 2 were given

class Converter:
    def convIMG2JPG(self):

        os.mkdir(inputfile+"\\"+Path(inputfile).stem)

        im = Image.open(inputfile)
        rgb_im = im.convert('RGB')
        rgb_im.save(outputdir+"\\"+ Path(inputfile).stem+"\\"+ Path(inputfile).stem + ".jpg")

    def convertDocument(inputfile):
        if(file_extension == ".gif" or file_extension == ".jfif" or file_extension == ".jpeg" or file_extension == ".jpg"
            or file_extension == ".BMP" or file_extension == ".png"):

            convIMG2JPG(inputfile)


convert = Converter()
input = "/10791227_7168491604.jpg"
convert.convertDocument(input)

1 Answers1

1

You need to change

def convertDocument(inputfile):
    ...

to

def convertDocument(self, inputfile):
    ...
dangee1705
  • 3,445
  • 1
  • 21
  • 40