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

Photobox

Posted by Jeremy on Sep 22, 2008

My tif files will not display the transparency data when using Photobox. I tried the same files with CoreImage and it 'respected' the transparency.

Is there something wrong with my code?

pb = ximport("photobot")
c = pb.canvas(750, 750)
reload(pb)
 
#f = files("images/*.tif")
#image(choice(f), 10, 10)
 
tiles = ["_images/1.tif", "_images/2.tif", "_images/3.tif", "_images/4.tif", "_images/5.tif", "_images/6.tif", "_images/7.tif", "_images/8.tif"]
 
c.fill((255,255,255))
c.layer(choice(tiles))  
n = 3
 
for i in range(64):
 
 c.layer(choice(tiles))
 c.layers[n+i].contrast(1.1)
 w, h = c.layers[i+n].bounds()
 
 c.gradient(pb.LINEAR, w/2, h)
 c.layers[n+i+1].flip()
 c.layers[n+i+1].translate(w/2, 0)
 c.gradient(pb.LINEAR, w/2, h)
 c.merge([n+i+1, n+i+2])
 c.layers[n+i+1].brightness(random(4))
 c.layers[n+i+1].mask()
 
 c.layers[n+i].rotate(random(90))
 
 c.layers[n+i].translate(i*w/3, 0)
 
 if random() > 0.5: c.layers[n+i].flip()
 if random() > 0.5: c.layers[n+i].blur()
 
c.fill((200,100,0))
c.layers[n+i+1].opacity(60)
c.layers[n+i+1].hue()
 
#c.layer("_images/1.tif")
c.layers[n+i+1].opacity(40)
c.layers[n+i+1].overlay()
 
c.draw(100, 100)


 
Posted by impiaaa on Sep 24, 2008

I don't think there's anything wrong with your code, because from my experience, TIFF images aren't very nice with alpha channels. Try converting them to PNGs instead.



Posted by Tom De Smedt on Sep 25, 2008

As impiaaa suggests, use PNG images with transparency. PhotoBot doesn't handle transparent TIFF, and at the moment we are not actively developing PhotoBot. If for some reason you can only use TIFF, I'd suggest switching to the Core Image libray.