1

I'm working on a website that will handle image uploads so I need to verify for valid images, and I have two options, I either use PIL(Pillow) or the imghdr module.

My question is, which one should I use? Since PIL is not being mantained will imghdr module do the job? Which of them is secure and/or efficient?

Thanks.

Hanxue
  • 12,243
  • 18
  • 88
  • 130

1 Answers1

1

Plese note that PIL and Pillow is not the same package. Pillow is a fork of PIL that is considered to be PIL's successor.

To work with images in a website (I assume because of your tag, that it's a django project), it's recommended to use Pillow. For example, if you want to use ImageField, it requires the Pillow library.

ferrangb
  • 2,012
  • 2
  • 20
  • 34
  • Thanks for your answer, I am currently using Pillow but because I'm not using Django models to save data into SQL(I'm using mongo) I need to validate the ImageField manually before saving the file into system. – user3400075 Aug 26 '14 at 19:10