Py Processing pixels[] array does not contain all pixels in large images
<p>I'm using Processing in Python mode to load an image and do a calculation on it. The general idea is:</p>

<pre><code>def setup():
    global maxx, maxy
    maxx = 0
    maxy = 0

    # load the image
    global img
    img = loadImage("img.jpg");

    maxx = img.width
    maxy = img.height

def draw():
    image(img, 0, 0);

def mousePressed():
    calc()

def calc():
    height = int(img.height)
    width = int(img.width)
    print "width: " + `width`
    print "height: " + `height`
    print "width*height: " + `width*height`

    # iterate over the input image
    loadPixels()
    print "length of pixels array: " + `len(pixels)`

    # ... do stuff with the image
</code></pre>

<p>for smaller images on the order of 1920x1200, the "width * height" and "length of pixel array" are the same. For large images like 3025âÃâ2009, the length of the pixels array is substantially less. For the example of 3025 x 2009 the difference is:<br>
width*height: 6077225
length of pixels array: 3944600</p>

<p>Any ideas what might be going on?</p>

<p>In debugging, I found the problem. Calling loadPixel in the img gets the correct pixels ...</p>

<pre><code>def calc():
    height = int(img.height)
    width = int(img.width)
    print "width: " + `width`
    print "height: " + `height`
    print "width*height: " + `width*height`

    # iterate over the input image
    img.loadPixels()
    print "length of pixels array: " + `len(img.pixels)`
</code></pre>

<p>I'll update this answer after more research on the loadPixels()</p>

python processing pixels loadimage