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() |
Author
anishmenon
commented
Jun 4, 2014
How to set watermark in position of 10 pixel from bottom,because after using your code,the watermark logo showing at the bottom of the image,i want to set it in the center,is it possible?
Its like a one men show .. Sorry to answer .. Please b happy with my replies and google it.
The way you help me,it was awesome.Thanks a lot.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment