Opened 12 years ago
Closed 12 years ago
#20193 closed Uncategorized (duplicate)
About replacing PIL with Wand
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello,
I've been using Django 1.3 on a small project and have a custom template tag to return image dimensions. I have imported the django.core.files.images module. The PIL library which is in use there seems to be a little restrictive in terms of the kinds of files it can accept. I used a sample TIF file I had and called 'get_image_dimensions' with this file path. PIL was not able to identify the TIF file. A simple JPG file worked fine.
Instead, I used Wand on the same TIF file and was able to get dimensions accurately. Here's an example of it's usage from the page:
http://docs.wand-py.org/en/0.2-maintenance/index.html
from wand.image import Image
with Image(filename='mona-lisa.png') as img:
print img.size
I have not tried any further to validate the robustness of this package, but general reading seemed to suggest that Wand is a newer version layered upon ImageMagick and may even have a PIL compatibility layer in the future.
Just wanted to bring this up for consideration. Thanks for your time.
Moving away from PIL was brought up a few weeks ago on the django-developers mailing list. The current plan appears to be to move to Pillow.
See the thread https://groups.google.com/forum/?fromgroups=#!searchin/django-developers/pil/django-developers/lEieWsPZNH0/7dyZgb7MUbUJ
And the resulting ticket: https://code.djangoproject.com/ticket/19934
If you have an opinion on what package to move to, I'd recommend commenting in that ticket.
Best,
Matt