Beispiel #1
0
 def process(self, filename="girl.jpg", filtername="blur"):
     path = "../../public/tmp/"
     
     # check if processed already, in that case just toss the url back
     if os.path.exists(path + filtername + "_" + filename):
         return {'src': '/tmp/' + filtername + "_" + filename,
                 'filter': filtername}
     
     # is the said file actually uploaded?
     elif not os.path.exists(path + filename):
         return self.retError("The file '{0}' is not uploaded to the server.".format(filename))
     
     
     c = CImageInstagram(path + filename)
     c.applyFilter(filtername)
     if c.isChanged():
         c.save(path + filtername + '_' + filename)
         return {'src': self.getUrl(filename, filtername.lower()),
                 'filter': filtername}
     else:
         return self.retError("No filter with that name, consult documentation.")
Beispiel #2
0
print "This is the first line of our Instagram application"
from CImageInstagram import CImageInstagram
from Filters.CFilterBrigthness import CFilterBrigthness
from Filters.CFilterBlur import CFilterBlur
from Filters.CFilterGrayscale import CFilterGrayscale
from Filters.CFilterVignette import CFilterVignette
from Filters.CFilterTest import CFilterTest
from Filters.CFilterColor import CFilterColor
from Filters.CFilterPrime import CFilterPrime
from Filters.CFilterContrast import CFilterContrast
from Filters.CFilterPlainBorder import CFilterPlainBorder
from Filters.CFilterInvert import CFilterInvert
import time


c = CImageInstagram("../pic/girl.jpg")
c.setDecription("This is a comment to this image")
c.printDescription()

filters =  [
           #CFilterPlainBorder(25, (0,0,0)),
           CFilterColor([1,0,0]),
           #CFilterBlur(),
           #CFilterVignette(1),
           #CFilterPrime(),
           #CFilterInvert(),
           #CFilterContrast(),
           #CFilterBrigthness(1),
           #CFilterGrayscale(),
           #CFilterTest(),
           ]