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

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 2012-03-04 14:09 +0000
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>
Newsgroups comp.lang.python
Message-ID <mailman.380.1330870177.3037.python-list@python.org> (permalink)

Show all headers | 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