thanks a lot steven kryskalla
ur more than helpful
Steven Kryskalla wrote:
> a wrote:
> > /favicon.ico
> >
> > i want to get the favicon.ico from the URL when a blog is added to the
> > aggregator
> >
> > and then display the image,
> > this is the usage scenario
> >
> > Please let me know how to do this in python
> >
>
> You can use PIL (http://www.pythonware.com/products/pil) to convert
> favicons to other image formats (PNG, GIF, etc.).  Getting the favicon
> data into Python is pretty easy too, just use urllib.  You should be
> able to do something like this (maybe in a different process though,
> create a task using the scheduler):
>
> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import Image, urllib, cStringIO
> >>> #first, download the favicon data
> >>> favicondata = urllib.urlopen("http://www.google.com/favicon.ico";).read()
> >>> #next, write the favicon to a StringIO file-like object
> >>> f = cStringIO.StringIO()
> >>> f.write(favicondata)
> >>> #rewind back to the beginning of the file and load using PIL
> >>> f.seek(0)
> >>> img = Image.open(f)
> >>> #save to the filesystem (or to a database, etc.)
> >>> img.save("/whatever/favicon.google.png", format="PNG")
> >>>
> 
> Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to