def resize_image(filename: str) -> str:
    im = Image.open(filename)
    maxsize = 512
    scale = (maxsize / max(im.width, im.height))
    sizenew = (int((im.width * scale)), int((im.height * scale)))
    im = im.resize(sizenew, Image.NEAREST)
    (downpath, f_name) = os.path.split(filename)
    png_image = os.path.join(downpath, f"{f_name.split('.', 1)[0]}.png")
    im.save(png_image, 'PNG')
    if (png_image != filename):
        os.remove(filename)
    return png_image
def resize_image(filename: str) -> str:
    im = Image.open(filename)
    maxsize = 512
    scale = (maxsize / max(im.width, im.height))
    sizenew = (int((im.width * scale)), int((im.height * scale)))
    im = im.resize(sizenew, Image.NEAREST)
    (downpath, f_name) = os.path.split(filename)
    png_image = os.path.join(downpath, f"{f_name.split('.', 1)[0]}.png")
    im.save(png_image, 'PNG')
    if (png_image != filename):
        os.remove(filename)
    return png_image