<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Secondly, it has no way to display the image drawn on. Is it possible, or do<br>
I have to pass the image off to another module's methods?</blockquote></blockquote></blockquote>im.show() <div>this will display the image (and any modification(s) made to it)<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Example: Draw a Grey Cross Over an Image<br>
import Image, ImageDraw<br>
im = Image.open("lena.pgm")<br>
draw = ImageDraw.Draw(im)<br>
draw.line((0, 0) + im.size, fill=128)<br>
draw.line((0, im.size[1], im.size[0], 0), fill=128)<br>
del draw<br>
# write to stdout<br>
im.save(sys.stdout, "PNG")<br>
<br>
Hope that helps<br>
</blockquote>
That's pretty much the code I used. In fact, I borrowed it from the pdf. I just tried it, and it output "%PNG".<br>
<br></blockquote></div>im.save("picture1.png")<br>OR<br>im.save("picture1" "png") # not sure if it has to be "PNG"<br><br>What was happening earlier was that the binary data was being directed to the standard output, which is where all your text is printed by a print statement (print func in Py 3000). If you open a png in notepad, you will notice that the 1st four characters are indeed %PNG, which is the magic number for a PNG file.<br>
For further info, see:<br><a href="http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Magic_numbers_in_files">http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files</a><br><a href="http://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header">http://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header</a><br>
<br>Regards,<br>Ferdi<br>