0

I am creating a stock photo site. I need to add watermark temporarily while displaying in django template so that user shouldn't be able to download original photo without purchasing. I've tried django-watermark but got error while migrating. python 3.8+ and django 3.1.3+

So far I've overlapped images using this code,

water_mark_image = Image.open(settings.MEDIA_ROOT+'/water.png')
water_mark_image = wat.resize((int(im.width/2), int((im.width/2)*(h/w))))
Original_image.paste(wat, (int((im.width-wat.width)/2), int((im.height-wat.height)/1)), mask=wat)

but while downloading image comes along with watermark. I dont want to save duplicate image. Please suggest me a way to add watermark temporarily while displaying in detail.

Siva Sankar
  • 1,672
  • 1
  • 9
  • 16
  • If you don't want to save a duplicate I assume you would want to "create" a new image everytime a user looks at an image he/she did not buy? So you need to alter the existing image on every request. That sounds like a processor intensive operation to me. If you really want that, get the object and before rendering the page save it in memory and make the adjustments there. Then serve it out with your page. Again, I would just make a duplicate that can be cached and fetched upon each call. Much more performant. – JustLudo Nov 30 '20 at 14:37
  • Okay. What is the right method and how to achieve it? for python3 and django3 – Siva Sankar Nov 30 '20 at 15:03

0 Answers0