HOME/Articles/

pil example jpg test (snippet)

Article Outline

Python pil example 'jpg test'

Modules used in program:

  • import sys
  • import os
  • import PIL.Image

python jpg test

Python pil example: jpg test

import PIL.Image
import os
import sys

imgpath = os.path.join(os.path.dirname(__file__), 'sample.jpg')

if not os.path.isfile(imgpath):
  print(imgpath, ' does not exist')
  sys.exit(1)

im = PIL.Image.open(imgpath)
im.show()