Last active
August 29, 2015 14:02
-
-
Save anishmenon/6a67654846dcaab736e8 to your computer and use it in GitHub Desktop.
Watermark Image - PIL django python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
#your views | |
slider = YourImageModel.objects.get(id=id) | |
watermark = Image.open("path to your watermark image file") | |
img = Image.open(slider.image.file) | |
img.paste(watermark,(img.size[0]-watermark.size[0],img.size[1]-watermark.size[1]),watermark) | |
image = img.resize((1400, 560), Image.ANTIALIAS) | |
image.save('{0}/{1}'.format(settings.MEDIA_ROOT,slider.image.name), quality=80) | |
slider.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The way you help me,it was awesome.Thanks a lot.