1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

offset

Posted by Trumpetto on Jan 22, 2010



Dear readers,

I think I'm missing out on something. In the code you can see a very simple example that reads colors from pixel of an image and writes back blocks with that color.

All things work fine untill I uncomment the 'fill(clr)' command. It results in all the blocks getting a vertical offset around the 90/100 pixels. WHY?

The image is 800 x 600.

Greetz, Trumpetto

size(400,400)
 
coreimage = ximport("coreimage")
canvas = coreimage.canvas(400,400)
 
l = canvas.layer("test.jpg")
p = l.pixels()
canvas.draw()
 
fill(1)
 
fill(0.2)
for x, y in grid(40, 40, 10, 10):
    clr = p.get_pixel(x, y)
    # fill(clr)
    rect(x, y, 5, 5)


 
Posted by Josh Caswell on Jan 23, 2010

I'm not sure I understand. You say that the rect's you are drawing change position depending on that commented line? I tried your script and that is not the case for me. The rect's remain in the same place regardless of that call to fill().



Posted by Trumpetto on Jan 23, 2010

Exactly. I'll upload the image that I get without the call to fill as I showed above.



Posted by Josh Caswell on Jan 24, 2010

I see what you mean, but I'm afraid it's not happening for me. What you posted here is exactly the script you're running to generate these images? You're on the latest version of NodeBox and coreimage?



Posted by Trumpetto on Jan 24, 2010

Thanks for the comments. I found out that all works fine when I use a picture that is 400x400 pixels.
So I did not solve it yet but I know how I can deal with it.