Hello everyone,
I have an array of numbers from my txt file,
e.g. line[0] = img[0], line[1] = img[1], …
it seems to read all of the images but it only saves one. the code doesn’t give me an error yet it’s not saving multiple images even though when i type println(currentImage) it shows me all of the numbers corresponding to the new array of images. Can someone help me figure out what I’m doing wrong??
p.s. the code below is only addressing where the issue falls, the rest is the functions that are being called.
import java.util.Date;
String[] lines;
int index = 0;
PImage img;
int currentImage = 0;
int mode = 0;
int loops = 1;
int blackValue;
int brigthnessValue;
int whiteValue;
int row = 0;
int column = 0;
void setup() {
size(200, 200);
//frameRate(30);
lines = loadStrings("test.txt");
String path = sketchPath() + "/draft";
//println("Listing all filenames in a directory: ");
String[] filenames = listFileNames(path);
//printArray(filenames);
StringList newfilenames = new StringList();
for (int i = 0; i < filenames.length; i++) {
if (filenames[i].contains(".png")) {
newfilenames.push(filenames[i]);
}
}
for (int i = 0; i < lines.length; i++) {
// Load the new image
//printArray(path + "/" + newfilenames.get(currentImage));
img = loadImage(path + "/" + newfilenames.get(currentImage));
float fftBands = float(lines[i]);
float imgAlpha = map(fftBands, 10, 2000, 500000, -10000000); //frequency w/minim lib
int blackAlpha = floor(imgAlpha);
image(img, 0,0);
if (mode == 0) {
blackValue = blackAlpha;
}
row = 0;
column = 0;
while (column < width-1) {
img.loadPixels();
sortColumn();
column++;
img.updatePixels();
}
while (row < height-1) {
img.loadPixels();
sortRow();
row++;
img.updatePixels();
}
// Save the image
img.save("test-pngs/draft000-####.png");
currentImage++;
}
}