Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21198

Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign

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 <python-python-list@m.gmane.org>
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 <maxerickson@gmail.com>
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> <d2bb7721-2472-4863-b73d-6aa128b717a3@q12g2000yqg.googlegroups.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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.380.1330870177.3037.python-list@python.org> (permalink)
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

Show key headers only | View raw


Petr Jakes <petr.jakes.tpc@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to convert simple B/W graphic to the dot matrix for the LED display/sign Petr Jakes <petr.jakes.tpc@gmail.com> - 2012-03-04 02:28 -0800
  Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-04 10:54 +0000
    Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign Petr Jakes <petr.jakes.tpc@gmail.com> - 2012-03-04 04:47 -0800
      Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign Max Erickson <maxerickson@gmail.com> - 2012-03-04 14:09 +0000
        Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign Petr Jakes <petr.jakes.tpc@gmail.com> - 2012-03-05 05:53 -0800

csiph-web