<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Comments on article "Inserting legend in images using PIL"</title>
<link>http://base-art.net/Articles/30/</link>
<description>&lt;p&gt;I wanted to insert legends directly in images instead of displaying them below respective images. ImageMagick can do that (Text directive) but it's not smart enough to make the legend &lt;em&gt;always&lt;/em&gt; visible, even in dark images (if the legend color is black). So i used this &lt;a class="reference" href="http://svn.pythonfr.org/public/pythonfr/utils/misc/annotateImage.py"&gt;script&lt;/a&gt; to accomplish that task. Legend is inserted at the bottom of the image, in a little black bordered box. Advice: use &lt;a class="reference" href="http://effbot.org/pil/pilfonts.zip"&gt;pilfonts&lt;/a&gt; because default font is a bit small :-)&lt;/p&gt;
&lt;p&gt;Here is a sample output:&lt;/p&gt;
&lt;p&gt;&lt;img align="center" alt="http://base-art.net/static/sample.png" src="http://base-art.net/static/sample.png" /&gt;&lt;/p&gt;
</description>
<language>en</language>
<copyright>The contents of this blog are available for non-commercial use only.</copyright>
<generator>Alinea http://pythonfr.org/alinea/</generator>


<item>
<title>Fredrik on Inserting legend in images using PIL</title>
<link>http://base-art.net/Comments/95/</link>
<guid isPermaLink="true">http://base-art.net/Comments/95/</guid>
<description><![CDATA[
&lt;p&gt;&lt;a class="reference" href="http://toolbar.google.com/"&gt;http://toolbar.google.com/&lt;/a&gt;&lt;/p&gt;

]]></description>
<dc:creator>Fredrik</dc:creator>
<dc:date>2005-02-12T08:44:25Z</dc:date>
</item>

<item>
<title>phil on Inserting legend in images using PIL</title>
<link>http://base-art.net/Comments/94/</link>
<guid isPermaLink="true">http://base-art.net/Comments/94/</guid>
<description><![CDATA[
&lt;p&gt;Fredrik,&lt;/p&gt;
&lt;p&gt;Thanks for the explanation about RGB.&lt;/p&gt;
&lt;p&gt;About popups, i'm not that surprised about IE's popup blocker but can you explain the second part of the note :&lt;/p&gt;
&lt;pre class="literal-block"&gt;
neither the built-in variant nor the google bar likes your popup window
&lt;/pre&gt;

]]></description>
<dc:creator>phil</dc:creator>
<dc:date>2005-02-11T23:06:22Z</dc:date>
</item>

<item>
<title>Fredrik on Inserting legend in images using PIL</title>
<link>http://base-art.net/Comments/93/</link>
<guid isPermaLink="true">http://base-art.net/Comments/93/</guid>
<description><![CDATA[
&lt;p&gt;Since you're pasting RGB data on top of the image, the target image has to be an RGB (or RGBA) image as well.  GIF always contains 8-bit palette data, JPEG is almost always RGB (and never ever palette data).  To make sure you have an RGB image, add&lt;/p&gt;
&lt;blockquote&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;if image.mode != &amp;quot;RGB&amp;quot;:&lt;/dt&gt;
&lt;dd&gt;image = image.convert(&amp;quot;RGB&amp;quot;)&lt;/dd&gt;
&lt;/dl&gt;
&lt;/blockquote&gt;
&lt;p&gt;to the appropriate place.&lt;/p&gt;
&lt;p&gt;(btw, your preview function isn't compatible with IE's popup blockers (neither the built-in variant nor the google bar likes your popup window)).&lt;/p&gt;

]]></description>
<dc:creator>Fredrik</dc:creator>
<dc:date>2005-02-11T20:05:35Z</dc:date>
</item>

<item>
<title>phil on Inserting legend in images using PIL</title>
<link>http://base-art.net/Comments/92/</link>
<guid isPermaLink="true">http://base-art.net/Comments/92/</guid>
<description><![CDATA[
&lt;p&gt;I only tested the script with jpeg images, i'll try to make it more compatible with other image formats .. And also i need to handle the case where the legend dimensions don't fit in the image.&lt;/p&gt;

]]></description>
<dc:creator>phil</dc:creator>
<dc:date>2005-02-10T12:09:36Z</dc:date>
</item>

<item>
<title>Mike Watkins on Inserting legend in images using PIL</title>
<link>http://base-art.net/Comments/91/</link>
<guid isPermaLink="true">http://base-art.net/Comments/91/</guid>
<description><![CDATA[
&lt;p&gt;ps, converted image to jpg - success; png form of same - failure - although an image is generated. File sizes expand quite a bit, particularly on the png so I presume its the output pre-compression or something like that. Image manipulation is not one of my fortes but I'll keep digging. Thanks for the head start...&lt;/p&gt;

]]></description>
<dc:creator>Mike Watkins</dc:creator>
<dc:date>2005-02-09T18:41:02Z</dc:date>
</item>

<item>
<title>Mike Watkins on Inserting legend in images using PIL</title>
<link>http://base-art.net/Comments/89/</link>
<guid isPermaLink="true">http://base-art.net/Comments/89/</guid>
<description><![CDATA[
Thanks for your example - I've been meaning to pick up PIL for a drive and this may kickstart me. I fed your script a 441px x 336px GIF image and got this - any suggestions for a first look?&lt;br/&gt;&lt;br/&gt;Traceback (most recent call last):&lt;br/&gt;&amp;nbsp; File "../test.py", line 80, in ?&lt;br/&gt;&amp;nbsp; &amp;nbsp; annotate(image, text, destination, font)&lt;br/&gt;&amp;nbsp; File "../test.py", line 54, in annotate&lt;br/&gt;&amp;nbsp; &amp;nbsp; inboundBox = Image.blend(inboundBox, textBox, 0.5) &lt;br/&gt;&amp;nbsp; File "/usr/local/lib/python2.4/site-packages/PIL/Image.py", line 1599, in blend&lt;br/&gt;&amp;nbsp; &amp;nbsp; return im1._new(core.blend(im1.im, im2.im, alpha))&lt;br/&gt;ValueError: images do not match&lt;br/&gt;
]]></description>
<dc:creator>Mike Watkins</dc:creator>
<dc:date>2005-02-09T17:55:05Z</dc:date>
</item>


</channel>
</rss>