Re: Code critique please

2015-04-07 Thread kai . peters
On Tuesday, 7 April 2015 15:43:44 UTC-7, kai.p...@gmail.com wrote: > I just wrote this bit (coming from Pascal) and am wondering how seasoned > Python programmers would have done the same? Anything terribly non-python? > > As always, thanks for all input. > > K > > > > """ > Creates a PNG i

Code critique please

2015-04-07 Thread kai . peters
I just wrote this bit (coming from Pascal) and am wondering how seasoned Python programmers would have done the same? Anything terribly non-python? As always, thanks for all input. K """ Creates a PNG image from EPD file """ import os, sys from PIL import Image, ImageFont, ImageDraw #

Image rotation issue

2015-03-30 Thread kai . peters
Last week some readers have kindly supplied ideas and code for a question I had asked around a form of image data compression required for specialized display hardware. I was able to solve my issues for all but one: The black & white only device (1024 (X) x 1280 (Y)) expects the compressed dat

Re: PIL(LOW) - What am I missing?

2015-03-25 Thread kai . peters
On Wednesday, 25 March 2015 20:54:21 UTC-7, kai.p...@gmail.com wrote: > I create an image as per: > > img = Image.new('1', (1024, 1280), 1) > > I then draw on it and do: > > imagedata = list(img.getdata()) > print len(imagedata) > > This gives me 1228800 instead of the expec

PIL(LOW) - What am I missing?

2015-03-25 Thread kai . peters
I create an image as per: img = Image.new('1', (1024, 1280), 1) I then draw on it and do: imagedata = list(img.getdata()) print len(imagedata) This gives me 1228800 instead of the expected 1310720 (1024 * 1280) - any ideas what I am missing? As always, any help much

Re: Newbie looking for elegant solution

2015-03-25 Thread kai . peters
On Wednesday, 25 March 2015 18:10:00 UTC-7, Paul Rubin wrote: > nobody writes: > > I though that the bytes type is Python 3 only? If so, I cannot use it. > > In Python 2, the regular string type (str) is a byte vector, though it > is immutable. Do you send one scan line at a time to the renderin

Re: Newbie looking for elegant solution

2015-03-25 Thread kai . peters
On Tuesday, 24 March 2015 20:14:06 UTC-7, otaksoft...@gmail.com wrote: > I have a list containing 9600 integer elements - each integer is either 0 or > 1. > > Starting at the front of the list, I need to combine 8 list elements into 1 > by treating them as if they were bits of one byte with 1 a

Re: Newbie looking for elegant solution

2015-03-25 Thread kai . peters
On Tuesday, 24 March 2015 20:14:06 UTC-7, otaksoft...@gmail.com wrote: > I have a list containing 9600 integer elements - each integer is either 0 or > 1. > > Starting at the front of the list, I need to combine 8 list elements into 1 > by treating them as if they were bits of one byte with 1 a

Re: Newbie looking for elegant solution

2015-03-24 Thread kai . peters
On Tuesday, 24 March 2015 21:20:11 UTC-7, Chris Angelico wrote: > On Wed, Mar 25, 2015 at 3:04 PM, Paul Rubin wrote: > > This works for me in Python 2.7 but I think > > Python 3 gratuitously broke tuple unpacking so it won't work there: > > > >

Re: Newbie looking for elegant solution

2015-03-24 Thread kai . peters
On Tuesday, 24 March 2015 21:04:37 UTC-7, Paul Rubin wrote: > nobody writes: > > I have a list containing 9600 integer elements - each integer is > > either 0 or 1. > > Is that a homework problem? This works for me in Python 2.7 but I think > Python 3 gratuitously broke tuple unpacking so it won

Re: Pillow bug?

2015-03-24 Thread kai . peters
On Tuesday, 24 March 2015 13:15:42 UTC-7, Ian wrote: > On Tue, Mar 24, 2015 at 1:52 PM, Kai wrote: > > Judging from the message archive, the image-sig list is (just about) dead? > > > > Disclaimer: Am a newbie - so anything is possible > > > > > > using 'RGB' works fine > > > > img = Image.ne

Pillow bug?

2015-03-24 Thread kai . peters
Judging from the message archive, the image-sig list is (just about) dead? Disclaimer: Am a newbie - so anything is possible using 'RGB' works fine img = Image.new('RGB', (inktile[0], inktile[1]), bgcolor) using '1' or 'L' does not (see trace below) img = Image.new('L', (inktile[0]

Re: Noob Parsing question

2015-02-18 Thread kai . peters
> >> > Given > >> > > >> > data = > >> > '{[][]}' > >> > > >> > How can I efficiently get dictionaries for each of the data blocks > >> > framed by <> ? > >> > > >> > Thanks for any help > >> > >> The question here is: What _can't_ happen? For instance, what happens > >> if Fred's name contains

Re: Noob Parsing question

2015-02-17 Thread kai . peters
> > Given > > > > data = > > '{[][]}' > > > > How can I efficiently get dictionaries for each of the data blocks framed > > by <> ? > > > > Thanks for any help > > The question here is: What _can't_ happen? For instance, what happens > if Fred's name contains a greater-than symbol, or a caret?

Noob Parsing question

2015-02-17 Thread kai . peters
Given data = '{[][]}' How can I efficiently get dictionaries for each of the data blocks framed by <> ? Thanks for any help KP -- https://mail.python.org/mailman/listinfo/python-list