View

Generar miniaturas con PIL

  1. def testImages(request):
  2.     from PIL import Image
  3.     path = (‘c:/images/soluciones__1.jpg’)
  4.     #content = ‘c:/images/soluciones1.jpg’
  5.     content = ‘c:/images/image.gif’
  6.     image = Image.open(content)
  7.     image.thumbnail((200,150), Image.ANTIALIAS)
  8.     image.save(path, image.format)
  9.     savelog(image.format)
  10.     del image

You may also like