<Image> = Image.open(<path>)<spanclass="hljs-comment"># Identifies format based on file contents.</span>
<Image> = <Image>.convert(<spanclass="hljs-string">'<mode>'</span>)<spanclass="hljs-comment"># Converts image to the new mode.</span>
<Image>.save(<path>)<spanclass="hljs-comment"># Selects format based on the path extension.</span>
<Image>.show()<spanclass="hljs-comment"># Opens image in default preview app.</span>
</code></pre>
<pre><codeclass="python language-python hljs"><int/tuple> = <Image>.getpixel((x, y)) <spanclass="hljs-comment"># Returns a pixel.</span>
<Image>.putpixel((x, y), <int/tuple>) <spanclass="hljs-comment"># Writes a pixel to the image.</span>