NaeD
Posts: 7
Joined: Mon May 13, 2013 7:46 pm

output file

Fri Jun 07, 2013 8:44 pm

Have looked through the forums but could not find the info

Is it possible to make the output file increase by 1 if the name already exsists?

I.e if I write the image image.jpg, the next photo.I take wiuld auto rename to image1.jpg, then image2.jpg etc..

Thanks

User avatar
drewibbo
Posts: 41
Joined: Tue Feb 26, 2013 11:54 am
Location: Worthing, UK
Contact: Website

Re: output file

Fri Jun 07, 2013 9:42 pm

Hi,

it is very easy. If you use a while statement you can increment the number.

Code: Select all

i=0
while [ $i -lt 750 ] # or any other number...
 do

# use your image capture code here...
 fswebcam -r 1280x720 -S 15 --jpeg 99 -p MJPEG  --save home$i.jpg -q

# this is where you increment the $i variable...
 i=$(($i+1))
 done
 }
This will loop over the code 750 times incrementing $i by 1 each time.

this code is in bash but most languages will have a very similar set up. :D

Andy
Pi Pi Pi...

Return to “Camera board”