Loading multiple images with a wildcard?

Hi,
How do I load images numbered 0000 - 0100?

I have a series of images "frame-0000.png to “frame-0100.png”
If I use this code…

for (int i = 0; i < images.length; i ++ ) {   
 images[i] = loadImage( "frame-000" + i + ".png"); }

it will only load images 0-9.

If I it change to…

for (int i = 0; i < images.length; i ++ ) {  
  images[i] = loadImage( "frame-" + i + ".png"); }

it will of course complain there is no image called “frame-0.png” etc

How do I add a wildcard so it looks more like… or let “i” always be a four digit number with leading zeroes?

for (int i = 0; i < images.length; i ++ ) {
 images[i] = loadImage( "frame-" "*" + i + ".png"); }

Many thanks!

Hello,

One of these should take care of that:
image

There are resources (tutorials, references, examples) here:

:)

Ah ha, many thanks!
I had just started watching a first String tutorial on YouTube (Coding Train), and I see the next is called “Split and Join”, so that should be interesting
I’ve never coded anything before so I’m a bit slow

Many thanks! :slight_smile:

Hello,

Take a look at one (or all!) of the n*() ones… used a wildcard there!

:)

Ha ha, will do! :slight_smile:

Summary

(It seems I have to write at least 20 chars before I can post…)

)

Hello,

Keep in mind that some of the Processing “helper” functions\methods are there to simplify things.

I used one of the n*() functions here to clean up the output:
3D Mesh of Sine Waves from Coding Challenge

You can also use Java methods:

Since you are a beginner progress at your own pace.

:)

1 Like

Ahh, worked a treat!

Thanks for the example for printing the colour values, very helpful.
And interesting to know you can use Java syntax in addition!

Thanks again! :slight_smile:

1 Like