from PIL import Image import pathlib import os def convertImage(): inputImagePath = r"/path/to/photo.jpg" pathToImage = pathlib.Path(inputImagePath).parent.resolve() targetFileName = "outputFilename" outputFile = os.path.join(pathToImage, f"{targetFileName}.jpg") img = Image.open(inputImagePath) img.save(outputFile, dpi=(600, 600), res=(2400,3600)) img.close if __name__ == "__main__": convertImage()