Problem with blending two images
in
Programming Questions
•
3 years ago
Hi all ,
Am doing a program which blends between two images but I got this error
"The file "test.JPEG" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable."
this is my program :-
PImage img ;
PImage maskImg ;
int []id0 ={0,1,1,1,1,1,0,1,1};
int xCorner;
int yCorner;
int boxWidth;
int boxHeight;
void setup()
{
size(100, 100);
xCorner=10;
yCorner=10;
boxWidth=20;
boxHeight=20;
img =loadImage("test.JPEG");
maskImg=loadImage("rect2.JPEG");
img.blend(maskImg,12, 12, 76, 76, 12, 12, 76, 76, ADD);
image(img, 0, 0);
}
void draw()
{
background(0);
int xCount=0;
int yCount=0;
for(int i=0;i<id0.length;i++)
{
int value=id0[i];
if(value==1)
{
rect(xCorner+(boxWidth*xCount),yCorner+(boxHeight*yCount),boxHeight,boxWidth);
stroke(255);
fill(255);
save("rect2.JPEG");
}
xCount++;
if(xCount==3){
xCount=0;
yCount++;
}
}
}
any one tells me what I have to do please ..
thanks
Am doing a program which blends between two images but I got this error
"The file "test.JPEG" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable."
this is my program :-
PImage img ;
PImage maskImg ;
int []id0 ={0,1,1,1,1,1,0,1,1};
int xCorner;
int yCorner;
int boxWidth;
int boxHeight;
void setup()
{
size(100, 100);
xCorner=10;
yCorner=10;
boxWidth=20;
boxHeight=20;
img =loadImage("test.JPEG");
maskImg=loadImage("rect2.JPEG");
img.blend(maskImg,12, 12, 76, 76, 12, 12, 76, 76, ADD);
image(img, 0, 0);
}
void draw()
{
background(0);
int xCount=0;
int yCount=0;
for(int i=0;i<id0.length;i++)
{
int value=id0[i];
if(value==1)
{
rect(xCorner+(boxWidth*xCount),yCorner+(boxHeight*yCount),boxHeight,boxWidth);
stroke(255);
fill(255);
save("rect2.JPEG");
}
xCount++;
if(xCount==3){
xCount=0;
yCount++;
}
}
}
any one tells me what I have to do please ..
thanks
1