[Image-SIG] Digital Number

Fredrik Lundh fredrik at pythonware.com
Mon Nov 8 10:01:06 CET 2010


On Sun, Sep 19, 2010 at 12:19 PM,  <majoris.ursae at yahoo.co.uk> wrote:

> How to read pixel wise Digital Number (DN) of a JPG image using PIL?

You mean "Digital Number" in the ancient GIS sense?  I.e. simply the
value of a pixel?

The simplest way is to use getpixel(pos) where pos is a (x, y) tuple:

   http://effbot.org/tag/PIL.Image.Image.getpixel

If you need to read more than a few pixels, calling load() to get an
access object is more efficient:

   http://effbot.org/tag/PIL.Image.Image.load

</F>


More information about the Image-SIG mailing list