Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(using': 0.05; 'pixel': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'argument': 0.15; 'pil': 0.15; 'example).': 0.16; 'lookup': 0.16; 'numeral': 0.16; 'petr': 0.16; 'png': 0.16; 'subject:display': 0.16; 'subject:sign': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'accordingly.': 0.21; 'file,': 0.21; 'convert': 0.25; 'resolution': 0.26; 'load': 0.26; 'import': 0.27; 'object.': 0.30; 'header:User-Agent:1': 0.33; 'it?': 0.33; 'file': 0.34; 'header:X-Complaints-To:1': 0.34; 'subject:/': 0.34; 'to:addr:python-list': 0.35; 'switch': 0.35; 'subject:How': 0.35; 'received:org': 0.36; 'using': 0.37; 'format': 0.38; 'to:addr:python.org': 0.40; 'received:12': 0.66; 'subject:LED': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Max Erickson Subject: Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign Date: Sun, 4 Mar 2012 14:09:23 +0000 (UTC) References: <94052541-e1e0-43b6-b434-59e79518cf4a@q18g2000yqh.googlegroups.com> <4f5349f2$0$29989$c3e8da3$5496439d@news.astraweb.com> X-Gmane-NNTP-Posting-Host: 12.231.163.110 User-Agent: Xnews/2006.08.05 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1330870177 news.xs4all.nl 6974 [2001:888:2000:d::a6]:32953 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21198 Petr Jakes wrote: > >> What file format is the graphic in? How big is it? >> >> What file format do you want it to be? >> > > Now, I am able to create the png file with the resolution 432x64 > using PIL (using draw.text method for example). > > I would like to get the 432x64 True/False (Black/White) lookup > table from this file, so I can switch LEDs ON/OFF accordingly. > > -- > Petr > The convert and load methods are one way to do it: >>> import Image >>> im=Image.new('L', (100,100)) >>> im=im.convert('1') >>> px=im.load() >>> px[0,0] 0 That's the numeral one in the argument to convert. The load method returns a pixel access object. Max