import os
from PIL import Image


def resizeImage(inFile: str, outFile: str, maxDimension: int) -> None:
    if os.path.isfile(outFile):
        module_mtime = os.path.getmtime(__file__)
        source_mtime = os.path.getmtime(inFile)
        dest_mtime = os.path.getmtime(outFile)

        if module_mtime < dest_mtime and source_mtime < dest_mtime:
            return  # thumbnail already exists

    MAX_DIMS = (maxDimension, maxDimension)
    image = Image.open(inFile)
    image.thumbnail(MAX_DIMS, Image.ANTIALIAS)
    image.save(outFile, "JPEG")
