We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › question about blend()
Page Index Toggle Pages: 1
question about blend() (Read 197 times)
question about blend()
Nov 2nd, 2008, 3:52pm
 
hello

i tried the blend() function
http://processing.org/reference/blend_.html

background(loadImage("rockies.jpg"));
PImage img = loadImage("degaul.jpg");
image(img, 0, 0);
blend(img, 0, 0, 33, 100, 67, 0, 33, 100, SUBTRACT);

now i have one question.
how big is the image rockies.jpg?
100 x 100 pixel?
33 x 100 pixel?

i get allways the error
background image must be the same size as your application
Re: question about blend()
Reply #1 - Nov 3rd, 2008, 7:56am
 
See background() reference page: "An image can also be used as the background for a sketch, however its width and height must be the same size as the sketch window. To resize an image 'b' to the size of the sketch window, use b.resize(width, height)."

Example (using images in my sketchbook folder):
Code:
void setup()
{
size(600, 600);
PImage b = loadImage("../Johnson.jpg");
b.resize(width, height);
background(b);
PImage img = loadImage("../Globe.png");
image(img, 0, 0);
blend(img, 0, 0, 33, 100, 67, 0, 33, 100, SUBTRACT);
}

Or set size() parameters to the size of the image, or use some image viewer/editor to set the image size to the sketch size.
Page Index Toggle Pages: 1