# Get image number and looping number from filename parameters

**URL:** <https://discourse.processing.org/t/get-image-number-and-looping-number-from-filename-parameters/12537>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [July 6, 2019, 1:23pm UTC](https://discourse.processing.org/t/get-image-number-and-looping-number-from-filename-parameters/12537 "2019-07-06T13:23:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_nish](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/the_nish/32/5634_2.png) [@The\_nish](https://discourse.processing.org/u/The_nish)\
**Post date:** [July 6, 2019, 1:23pm UTC](https://discourse.processing.org/t/get-image-number-and-looping-number-from-filename-parameters/12537/1 "2019-07-06T13:23:06Z")

</div>

i want to give four digit name of an image like 0102. where two digit define image number and other two define looping time of image . is this is possible to get parameter from image name and use it in looping and other variables.

```auto
import processing.serial.*;

Serial myPort; 
int n,dataIn;
int maxImages = 5;
 int imageIndex = 0; 
PrintWriter output;
int i, j, k;
int a=20;
String s, p;
void setup()
{

  size(100, 100);

  output = createWriter("a.txt");
  myPort = new Serial(this, "COM6", 38400);
    
      PImage[] images = new PImage[maxImages];     
      
      for ( j=0;j<images.length;j++) 
      {
      images[j] = loadImage(j+".png");
      frameRate(1);
      images[j].loadPixels();
         imageIndex = (imageIndex + 1) % images.length;     
      }
      

  
}

void draw()
{

  function();
  //image(images[j], 0, 0);  

}

```

where j value is define image number and this code run images from 0 to 100.I want to given loop number in image but i don’t know how to do it in my code.  
please share your ans. thanks in advance .

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 6, 2019, 1:58pm UTC](https://discourse.processing.org/t/get-image-number-and-looping-number-from-filename-parameters/12537/2 "2019-07-06T13:58:47Z")

</div>

Research:  
[https://processing.org/reference/nf\_.html](https://processing.org/reference/nf_.html)  
[https://processing.org/reference/addition.html](https://processing.org/reference/addition.html)

This also works for 0 to 99:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1bdf8ca479425a191b5db80007bfcb4190cae0e0.png)

🙂
