raster (PIL)
Peter Otten
__peter__ at web.de
Thu Jul 23 09:43:36 EDT 2009
superpollo wrote:
> Peter Otten wrote:
> ...
>> im.convert("1").save(sys.stdout, "PNG")
> ...
>
> a q about pil:
>
> im.convert("1")
>
> is different from:
>
> im2 = im.convert("1")
>
> right?
>
> in the former im is changed (the method applies to im) but in the latter
> im is unchanged (first im is copied unto im2 and then the method is
> applied to im2)... am i right?
No. A method has no clue whether its result is used or discarded. Therefore
im.convert("1")
creates a new image in the specified mode, too, which is discarded
immediately. If you don't need the result you probably shouldn't call the
method at all.
Peter
More information about the Python-list
mailing list