Skip to content
Snippets Groups Projects
open_ppm.py 269 B
import os.path
from PIL import Image
def open_ppm(file):
    png = file[:-4]+".png"
    if os.path.isfile(png):
        image = Image.open(png)
    else:
        os.system(f"convert {file} {png}")
        image = Image.open(png)
        os.unlink(png)
    return image