Ejemplo n.º 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.")
Ejemplo n.º 2
0
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(),
           ]

oldtime =  time.time()
c.applyFilter(filters)
print time.time()-oldtime, "seconds taken for all filters"
#c.applyFilter(CFilterVignette(1))
c.showImage()
#c.im_copy.save("../editedpic/latest.png")