Log For A not-yet-done App

This is a collection of steps for building the app, Since I had to digg them from an awful lot of sources scattered around the Web, Just to put them together and make it easy for me to refer tomorrow.

Trying to write an Application that will generate a fb cover pic for my College’s Symposium promoters. First I needed to learn how PIL processed images, and yes, I got it. The Story goes like this,

  • And in the beginning there were two images and they were good :-)
  • One which the user uploads(Generating a common cover, would have been easier, but using user uploaded images give it a personal touch), and another image that will be designed by me to mask the user’s image.
  • A bit of editing of user’s pic. Increase brightness ImageEnhancer.Brightness(UserPic).enhance(1.5)
  • Then a desaturated effect with ImageEnhancer.Color(UserPic).enhance(0.5)
  • Then, a blurry touch with ImageEnhancer.Sharpness(UserPic).enhance(-0.5)
  • Thats it, Now blendedImage = Image.blend(MyPic, UserPic, 0.5) will give me a masked and merged image.
  • Then comes the slogan or tag whatever you call it. For this I have to use ImageDraw Class.
  • canvas = ImageDraw.Draw(MaskedImage)
    canvas.text((10,10),"My Text",(0,255,0))
    This wil write my text on the image, in programmer’s green :-)
  • Image ready to be stamped with our Symposium’s Seal. Stuff that can be done later, when the name gets finalised.

Instead of my friends uploading their pic, which is actually a boring part, why not let them enter their fb profile link and let my app fetch their current cover picture as ‘UserPic’.
That would be a bit more elegant way.
But it holds a problem. ‘Smart’ facebook coders have hidden all personal data from being read by any pre-programmed script.
This is the part where geeks have their role.
A bit of a hacking had to be done, after I came to know the intentionally placed "" had to be removed before parsing the html source.
import re
hackedHtml = re.sub('<!--', ' ', SecuredText)

That tiny piece of code did the thing.
So, Now I get hold of the user’s Cover and we all live happily ever after…
via QuickPress

Advertisements