Display images
in
Programming Questions
•
3 years ago
Hi all
I have a 27 images which is taken from a CSV file and I need to load all the images and display them in one time then save them , my problem is, when I try to display them ,they appear one image over the other . what can i do please so I can display them correctly .
here is my code that I used to load the images
PImage[] images;
int i;
Record[] records;
int recordCount;
void setup()
{ size(1000,1000);
images=new PImage[27];
frameRate(30);
String[] lines = loadStrings("test4.txt");
records = new Record[lines.length];
for (int i = 0; i < lines.length; i++)
{
String[] pieces = split(lines[i], ','); // Load data into array
if (pieces.length == 4)
{
records[recordCount] = new Record(pieces);
recordCount++;
}
}
/*for (int i = 0; i < recordCount; i++)
{
String img_name=records[i].img_name;
images[i]= loadImage("Processing\\sketch_sep07a\\"+img_name);
}
*/
}
void draw()
{
for (int i = 0; i < recordCount; i++)
{
String img_name=records[i].img_name;
images[i]= loadImage("Processing\\sketch_sep07a\\"+img_name);
image(images[i],0,0);
}
}
I have a 27 images which is taken from a CSV file and I need to load all the images and display them in one time then save them , my problem is, when I try to display them ,they appear one image over the other . what can i do please so I can display them correctly .
here is my code that I used to load the images
PImage[] images;
int i;
Record[] records;
int recordCount;
void setup()
{ size(1000,1000);
images=new PImage[27];
frameRate(30);
String[] lines = loadStrings("test4.txt");
records = new Record[lines.length];
for (int i = 0; i < lines.length; i++)
{
String[] pieces = split(lines[i], ','); // Load data into array
if (pieces.length == 4)
{
records[recordCount] = new Record(pieces);
recordCount++;
}
}
/*for (int i = 0; i < recordCount; i++)
{
String img_name=records[i].img_name;
images[i]= loadImage("Processing\\sketch_sep07a\\"+img_name);
}
*/
}
void draw()
{
for (int i = 0; i < recordCount; i++)
{
String img_name=records[i].img_name;
images[i]= loadImage("Processing\\sketch_sep07a\\"+img_name);
image(images[i],0,0);
}
}
1