0

I am importing bookmarks to a Mindmap-like app (called LeoEditor) after exporting them into HTML from Chrome or Firefox.

I can easily transform them into FolderName -> Web Name -> Web link

But I would like to know if its possible to transform the text they include into the icons for each website.

For instance, in the HTML code, each link to any website will have a code similar to this:

 <DT><A HREF="http://www.mozilla.com/en-US/about/" ADD_DATE="1365268840" LAST_MODIFIED="1365268840" ICON_URI="http://www.mozilla.org/2005/made-up-favicon/3-1365268840736" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==">About Us</A>

Can the string which begins as: ICON="data:image...." be transformed into an icon?

I want badges
  • 6,155
  • 5
  • 23
  • 38
  • If possible I would like to know how to transform it into an image through python. Thank you. – I want badges May 17 '13 at 16:54
  • You can paste that big long string into ``, if that's what you mean? E.g. `` – Danny Beckett May 17 '13 at 16:54
  • I would like to transform that string into a "ico" file or any image file to be able to use it as icon in the MindMap-software I am exporting it to, sorry for not being so clear – I want badges May 17 '13 at 17:05
  • Following on from my previous comment: http://jsfiddle.net/kJvMB/ Simply right-click -> save as a PNG file. You could use Greenfish Icon Editor to convert it to an ICO. – Danny Beckett May 17 '13 at 17:07
  • Ok, thank you very much. And in order to clarify and further help others (and me), is there any python script which will transform the string into png image through a command? Or, how could I transform that string into image in my computer? How is the process called/which is the software called to do that? I just need to know what I am doing, thank you again! – I want badges May 18 '13 at 09:24
  • And here is the answer to my second own question: http://stackoverflow.com/questions/5368669/convert-base64-to-image-in-python – I want badges May 18 '13 at 09:37
  • `Or, how could I transform that string into image in my computer?` Did you click the link in my last comment? – Danny Beckett May 18 '13 at 18:31
  • Yes, thank you, but by that quote I meant how to do it inside the computer without using online website. The question is perfectly answered, thanks, as soon as I can accept it I will :) – I want badges May 19 '13 at 10:48

1 Answers1

1

Just decode the base64 and save to file:

from base64 import b64decode
decoded = b64decode('iVBORw0KGgo...') # Full base64 string here
open("output.png", "wb").write(decoded)
Tzach
  • 12,889
  • 11
  • 68
  • 115