Skip to content

Instantly share code, notes, and snippets.

@cybertk
Created July 22, 2014 16:56
Show Gist options
  • Save cybertk/5bd1309b9b6da1213480 to your computer and use it in GitHub Desktop.
Save cybertk/5bd1309b9b6da1213480 to your computer and use it in GitHub Desktop.
Add a text watermark to give image
#!/usr/bin/env python
import os
import sys
TEXT_ID = 'itunesartwork'
# Provided by sw-dev.herokuapp.com
os.environ.setdefault('CLOUDINARY_URL',
'cloudinary://api_key:secret')
from cloudinary.utils import cloudinary_url
from cloudinary.uploader import text, destroy
# Delete exist text
print destroy(TEXT_ID, invalidate=True)
# Create text
print text("Sample Name", public_id = TEXT_ID,
font_family = 'Helvetica',
font_size = 120,
font_weight = 'bold',
font_color = 'black', opacity = 80)
print cloudinary_url("sample.png",
overlay = "text:%s:1.12.4.1" % TEXT_ID,
gravity = "south_east", x = 2, y = 60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment