<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Depth-First: Never Draw the Same Molecule Twice: Writing PNG Image Metadata with Python</title>
    <link>http://depth-first.com/articles/2007/08/29/never-draw-the-same-molecule-twice-writing-png-image-metadata-with-python</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Never Draw the Same Molecule Twice: Writing PNG Image Metadata with Python</title>
      <description>&lt;p&gt;&lt;a href="http://www.python.org/"&gt;&lt;img src="http://depth-first.com/files/python-logo.gif" align="right" border="0"&gt;&lt;/img&gt;&lt;/a&gt;A &lt;a href="http://depth-first.com/articles/2007/08/08/never-draw-the-same-molecule-twice-viewing-image-metadata"&gt;recent D-F article&lt;/a&gt; discussed a method for encoding machine-readable molecular structure information as image metadata. This article generated some interest among developers. For example, &lt;a href="http://baoilleach.blogspot.com"&gt;Noel O'Boyle&lt;/a&gt; posted code for &lt;a href="http://baoilleach.blogspot.com/2007/08/access-embedded-molecular-information.html"&gt;reading PNG image metadata with Python&lt;/a&gt;. The popularity of Python in cheminformatics makes this approach especially attractive.&lt;/p&gt;

&lt;p&gt;But how would you write PNG image metadata with Python? The obvious answer of using &lt;tt&gt;Image.info&lt;/tt&gt; followed by &lt;tt&gt;Image.write&lt;/tt&gt; doesn't appear to work. Given my limited knowledge of Python, the answer must come from elsewhere.&lt;/p&gt;

&lt;p&gt;Fortunately, &lt;a href="http://blog.modp.com/"&gt;Nick Galbreath&lt;/a&gt; wrote in to offer a solution. Using Python, &lt;a href="http://www.pythonware.com/products/pil/"&gt;PIL&lt;/a&gt;, and an undocumented class, Nick has developed &lt;a href="http://blog.modp.com/2007/08/python-pil-and-png-metadata-take-2.html"&gt;a small wrapper function&lt;/a&gt; that writes metadata for PNG images. In fact, Nick is &lt;a href="http://blog.modp.com/2007/08/png-metadata-from-command-line-again.html"&gt;fast on his way&lt;/a&gt; to becoming a PNG metadata expert, if reluctantly so. His blog is worth checking out and contains several useful techniques for image manipulation.&lt;/p&gt;</description>
      <pubDate>Wed, 29 Aug 2007 17:17:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:35a62aab-9f0e-4e94-b84c-c8ea6ee64d47</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2007/08/29/never-draw-the-same-molecule-twice-writing-png-image-metadata-with-python</link>
      <category>Tools</category>
      <category>python</category>
      <category>pil</category>
      <category>metadata</category>
    </item>
  </channel>
</rss>
