We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Nonjour When using manny images in a sketch for some sort of "diaporama" with manny images (inside a sketch using KINECT) I am looking for a solution making the image suffixes "indifferent" .............. example:
void setup() {
size(900,600);
frameRate(0.5);// speed 1 change the timerate here between 0.01 and 10
for(int i=0; i< images.length; i++) {
images[i] = loadImage("image_" + i + ".jpg");/////for .gif instead of .jpg change the data folder's images//////
}
............
normally you have to put into your DATA folder only images with one and the same suffix -
exemple: image_1.jpg image_2.jpg etc
now i want to make use of some image_3.gif image_4.gif etc
is there any solution ( a symbole like: * or $....) to make the suffix "indifferent" ,
in order to accept all the images with all the different suffixes, of coarse inside the suffixes
supported by PROCESSING 1.5.1
........ you see, my english and PROCESSING knowledge are limited , so please be patient
gottfried
Answers
it might work if you remove the extension completely, have images called image_0, image_1, image_2 etc and use
loadImage("image_" + i);
i'm thinking that the code will be able to determine the image type without the need for the extension... i haven't tested this though.
Perhaps what you want is File.list(dataPath(""))
Otherwise, if your files are numbered, you can try
loadImage()
with one extension, and if it returnsnull
, try with another extension... You can wrap this in a function to ease the usage of multiple tries.koogs, if no extension is given, I believe the type of image must be given in a second parameter.
.........yes
but any-how: why not simplify the solution by making the extentions jpg or png or gif just indifferent in former times there would have been the $$$ signs ot *** who replace the extentions....... and i like/need very simplfied solutions yesterday i made in Paris street a big performance-but nobody accepted to 'wait' trgree minutes to let me make the changements of the data folder with the other pictures, so???
thanks for your kind consideration
koog, thanks
your solution is half-way
i have this in my sketch i.e. for(int i=0; i< images.length; i++) { images[i] = loadImage("image_" + i + ".png"); but the probleme comes with that extention: ".png" as said to PhiLho
running with philho's idea:
thanks Koogs
i will try tomorrow, its night now here but this seems very reasonnable
good night from Paris gottfried
hello Kogg I made the try with Your first idea "...remove the extension completely, have images called image_0, image_1, image_2 etc and use loadImage("image_" + i);...." ....but I get the Null -the data folder hadn't been changed and is ok with the initial version of the well working sketch
here is one very simple sketch with 5 images, extention: with only .png for test reasons
philho pointed out that my first idea wouldn't work.
that later code i posted (december 7) was tested and does work. just put it at the bottom of your code and call that rather than loadImages()
yes, I understand now the signe ! makes other, new problems; but I will try harder thanks for today, Koogs