superpollo wrote:
> Peter Otten wrote:
>> 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 c
Peter Otten wrote:
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
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 (fir
superpollo wrote:
> Diez B. Roggisch wrote:
>> superpollo wrote:
> ...
>>>high = len(raster_lines)
>>>wide = len(raster_lines[0])
>>>bytes_in_a_row = wide/bits_in_a_byte
>>
>>
>> This will give you the wrong result if not divideable by bits_in_a_byte.
>>
>
> then maybe:
>
> #!/usr/bin/env pyt
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
a
Peter Otten wrote:
...
Here's a different approach:
...
raster_string = ...
width = raster_string.index("\n")
height = raster_string.count("\n")
your approach has a funny side-effect: try to remove just one zero from
the first line of the raster ;-)
bye
--
http://mail.python.org/mailman/l
Peter Otten wrote:
superpollo wrote:
i wrote a program which transforms a string of zeroes ando ones into a
png file.
...
any suggestions for improvement?
...
Here's a different approach:
...
The idea is to move the bit-twiddling from python to code written in C,
pointless for such a tin
Diez B. Roggisch wrote:
superpollo wrote:
...
high = len(raster_lines)
wide = len(raster_lines[0])
bytes_in_a_row = wide/bits_in_a_byte
This will give you the wrong result if not divideable by bits_in_a_byte.
then maybe:
#!/usr/bin/env python
import Image
import sys
bits_in_a_byte = 8
r
superpollo wrote:
> i wrote a program which transforms a string of zeroes ando ones into a
> png file.
>
> #!/usr/bin/env python
> import Image
> import sys
> bits_in_a_byte = 8
> raster_string = """\
>
> 0010010000101000
> 0010010010101000
superpollo wrote:
> hi.
>
> i wrote a program which transforms a string of zeroes ando ones into a
> png file.
>
> #!/usr/bin/env python
> import Image
> import sys
> bits_in_a_byte = 8
> raster_string = """\
>
> 0010010000101000
> 00100100101
10 matches
Mail list logo