~stani/phatch/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pil &mdash; Phatch v0.2 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '#',
        VERSION:     '0.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Phatch v0.2 documentation" href="index.html" />
    <link rel="up" title="core" href="core.html" />
    <link rel="next" title="preview" href="core.preview.html" />
    <link rel="prev" title="models" href="core.models.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="core.preview.html" title="preview"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="core.models.html" title="models"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Phatch v0.2 documentation</a> &raquo;</li>
          <li><a href="core.html" accesskey="U">core</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-core.pil">
<h1>pil<a class="headerlink" href="#module-core.pil" title="Permalink to this headline"></a></h1>
<p>All PIL related issues.</p>
<dl class="class">
<dt id="core.pil.InfoPhoto">
<em class="property">class </em><tt class="descclassname">core.pil.</tt><tt class="descname">InfoPhoto</tt><big>(</big><em>info</em>, <em>info_to_dump</em>, <em>get_pil</em>, <em>image=None</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">dict</span></tt></p>
<dl class="method">
<dt id="core.pil.InfoPhoto.assert_transparency">
<tt class="descname">assert_transparency</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.assert_transparency" title="Permalink to this definition"></a></dt>
<dd>Raise a <tt class="docutils literal"><span class="pre">KeyError</span></tt> for <tt class="docutils literal"><span class="pre">'transparency'</span></tt> when <tt class="docutils literal"><span class="pre">image.mode</span></tt>
is not <tt class="docutils literal"><span class="pre">'P'</span></tt>.</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.assert_writable">
<tt class="descname">assert_writable</tt><big>(</big><em>tag</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.assert_writable" title="Permalink to this definition"></a></dt>
<dd><p>Assert that the tag is writable. This can raise an
<tt class="docutils literal"><span class="pre">NotWritableTagError</span></tt> because of several reasons:</p>
<ul class="simple">
<li>Tag might be read-only (e.g. Exif_Photo_PixelXDimension)</li>
<li>Tag might be not Exif or Iptc</li>
<li>Image file format might not allow writing of this tag</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>tag</em> (string) &#8211; tag name</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True, if writable</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.clear_log">
<tt class="descname">clear_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.clear_log" title="Permalink to this definition"></a></dt>
<dd>Clears the log.</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.close" title="Permalink to this definition"></a></dt>
<dd>Remove circular reference.</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.get_log">
<tt class="descname">get_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.get_log" title="Permalink to this definition"></a></dt>
<dd><p>Get the log contents.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the log</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.is_dirty">
<tt class="descname">is_dirty</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.is_dirty" title="Permalink to this definition"></a></dt>
<dd><p>The photo can become dirty in two ways:</p>
<ul class="simple">
<li>new metadata has been set</li>
<li>the image has changes size</li>
</ul>
<p>In case the image size has changed it will update the
<tt class="docutils literal"><span class="pre">Exif.Photo.PixelXDimension</span></tt> and <tt class="docutils literal"><span class="pre">Exif.Photo.PixelYimension</span></tt>
accordingly.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True, if dirty</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.log">
<tt class="descname">log</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.log" title="Permalink to this definition"></a></dt>
<dd><p>Log a message</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>message</em> (string) &#8211; message</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.save">
<tt class="descname">save</tt><big>(</big><em>target</em>, <em>target_format=None</em>, <em>thumbdata=None</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.save" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>target</em> (string) &#8211; target filename</li>
<li><em>target_format</em> (string) &#8211; target format e.g. obtained by PIL</li>
<li><em>thumbdata</em> (string) &#8211; new thumbnail (eg with StringIO, see <tt class="xref docutils literal"><span class="pre">imtools</span></tt>)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.set">
<tt class="descname">set</tt><big>(</big><em>tag</em>, <em>value</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.set" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.update">
<tt class="descname">update</tt><big>(</big><em>d</em>, <em>explicit=True</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.update" title="Permalink to this definition"></a></dt>
<dd>Do this explicitly so __setitem__ gets called.</dd></dl>

<dl class="method">
<dt id="core.pil.InfoPhoto.update_size">
<tt class="descname">update_size</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.update_size" title="Permalink to this definition"></a></dt>
<dd>If the image is exif writable and if the size has changed,
it will update <tt class="docutils literal"><span class="pre">Exif.Photo.PixelXDimension</span></tt> and
<tt class="docutils literal"><span class="pre">Exif.Photo.PixelYimension</span></tt>.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="core.pil.Layer">
<em class="property">class </em><tt class="descclassname">core.pil.</tt><tt class="descname">Layer</tt><big>(</big><em>filename</em>, <em>position=(0</em>, <em>0)</em>, <em>load=True</em><big>)</big><a class="headerlink" href="#core.pil.Layer" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="core.pil.Layer.apply_pil">
<tt class="descname">apply_pil</tt><big>(</big><em>function</em>, <em>*arg</em>, <em>**keyw</em><big>)</big><a class="headerlink" href="#core.pil.Layer.apply_pil" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Layer.open">
<tt class="descname">open</tt><big>(</big><em>uri</em><big>)</big><a class="headerlink" href="#core.pil.Layer.open" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="exception">
<dt id="core.pil.NotWritableTagError">
<em class="property">exception </em><tt class="descclassname">core.pil.</tt><tt class="descname">NotWritableTagError</tt><a class="headerlink" href="#core.pil.NotWritableTagError" title="Permalink to this definition"></a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></dd></dl>

<dl class="class">
<dt id="core.pil.Photo">
<em class="property">class </em><tt class="descclassname">core.pil.</tt><tt class="descname">Photo</tt><big>(</big><em>info</em>, <em>info_to_dump=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo" title="Permalink to this definition"></a></dt>
<dd><p>Use <a title="core.pil.get_photo" class="reference internal" href="#core.pil.get_photo"><tt class="xref docutils literal"><span class="pre">get_photo()</span></tt></a> to obtain a photo from a filename.</p>
<dl class="method">
<dt id="core.pil.Photo.append_to_report">
<tt class="descname">append_to_report</tt><big>(</big><em>filename</em>, <em>image=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.append_to_report" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.apply_pil">
<tt class="descname">apply_pil</tt><big>(</big><em>function</em>, <em>*arg</em>, <em>**keyw</em><big>)</big><a class="headerlink" href="#core.pil.Photo.apply_pil" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.call">
<tt class="descname">call</tt><big>(</big><em>command</em>, <em>check_exe=True</em>, <em>size=None</em>, <em>unlock=False</em>, <em>output_filename=None</em>, <em>mode=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.call" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.clear_log">
<tt class="descname">clear_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.clear_log" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.close" title="Permalink to this definition"></a></dt>
<dd>Remove circular references.</dd></dl>

<dl class="method">
<dt id="core.pil.Photo.convert">
<tt class="descname">convert</tt><big>(</big><em>mode</em>, <em>*args</em>, <em>**keyw</em><big>)</big><a class="headerlink" href="#core.pil.Photo.convert" title="Permalink to this definition"></a></dt>
<dd>Converts all layers to a different mode.</dd></dl>

<dl class="method">
<dt id="core.pil.Photo.get_filename">
<tt class="descname">get_filename</tt><big>(</big><em>folder</em>, <em>filename</em>, <em>typ</em><big>)</big><a class="headerlink" href="#core.pil.Photo.get_filename" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.get_flattened_image">
<tt class="descname">get_flattened_image</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.get_flattened_image" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.get_layer">
<tt class="descname">get_layer</tt><big>(</big><em>name=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.get_layer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.get_log">
<tt class="descname">get_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.get_log" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.get_thumb">
<tt class="descname">get_thumb</tt><big>(</big><em>size=(128</em>, <em>128)</em><big>)</big><a class="headerlink" href="#core.pil.Photo.get_thumb" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.log">
<tt class="descname">log</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#core.pil.Photo.log" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.resize">
<tt class="descname">resize</tt><big>(</big><em>size</em>, <em>method</em><big>)</big><a class="headerlink" href="#core.pil.Photo.resize" title="Permalink to this definition"></a></dt>
<dd>Resizes all layers to a different size</dd></dl>

<dl class="method">
<dt id="core.pil.Photo.rotate_exif">
<tt class="descname">rotate_exif</tt><big>(</big><em>reverse=False</em><big>)</big><a class="headerlink" href="#core.pil.Photo.rotate_exif" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="core.pil.Photo.safe_mode">
<tt class="descname">safe_mode</tt><big>(</big><em>format</em><big>)</big><a class="headerlink" href="#core.pil.Photo.safe_mode" title="Permalink to this definition"></a></dt>
<dd>Convert the photo into a safe mode for this specific format</dd></dl>

<dl class="method">
<dt id="core.pil.Photo.save">
<tt class="descname">save</tt><big>(</big><em>filename</em>, <em>format=None</em>, <em>save_metadata=True</em>, <em>**options</em><big>)</big><a class="headerlink" href="#core.pil.Photo.save" title="Permalink to this definition"></a></dt>
<dd>Saves a flattened image</dd></dl>

<dl class="method">
<dt id="core.pil.Photo.set_layer">
<tt class="descname">set_layer</tt><big>(</big><em>layer</em>, <em>name=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.set_layer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="core.pil.fix_EXIF">
<tt class="descclassname">core.pil.</tt><tt class="descname">fix_EXIF</tt><big>(</big><em>tag</em><big>)</big><a class="headerlink" href="#core.pil.fix_EXIF" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="core.pil.get_photo">
<tt class="descclassname">core.pil.</tt><tt class="descname">get_photo</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#core.pil.get_photo" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="core.pil.image_to_dict">
<tt class="descclassname">core.pil.</tt><tt class="descname">image_to_dict</tt><big>(</big><em>filename</em>, <em>im=None</em><big>)</big><a class="headerlink" href="#core.pil.image_to_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="core.pil.split_data">
<tt class="descclassname">core.pil.</tt><tt class="descname">split_data</tt><big>(</big><em>d</em><big>)</big><a class="headerlink" href="#core.pil.split_data" title="Permalink to this definition"></a></dt>
<dd><p>Provide attribute access to the variables.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>d</em> (dict) &#8211; a dumped metadata dictionary</td>
</tr>
</tbody>
</table>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;date&#39;</span><span class="p">:</span> <span class="s">&#39;2008-11-27 13:54:33&#39;</span><span class="p">,</span> <span class="s">&#39;tuple&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)}</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="core.pil.split_vars_static_dynamic">
<tt class="descclassname">core.pil.</tt><tt class="descname">split_vars_static_dynamic</tt><big>(</big><em>vars</em><big>)</big><a class="headerlink" href="#core.pil.split_vars_static_dynamic" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h4>Previous topic</h4>
            <p class="topless"><a href="core.models.html"
                                  title="previous chapter">models</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="core.preview.html"
                                  title="next chapter">preview</a></p>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="core.preview.html" title="preview"
             >next</a> |</li>
        <li class="right" >
          <a href="core.models.html" title="models"
             >previous</a> |</li>
        <li><a href="index.html">Phatch v0.2 documentation</a> &raquo;</li>
          <li><a href="core.html" >core</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, www.stani.be.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
    </div>
  </body>
</html>