save() function keeps overwriting file names - how can I make file names increase numerically?

edited May 2017 in How To...

Hi, I'm super new to processing.

I've done a key press function where it saves an image that I've made various modifications to, but every time I press 's' to save, a new image saves and overwrites the previous image. I don't know how I can rename the files so that they can change automatically (e.g. every time I save it goes output_1.jpg, output_2.jpg and so on...).

I have two images side by side so I use saveFrame(); to save both of them and this is fine, but when I try to save just the image on the right (titled imgCopy), this is when the overwrite problem happens. Any solutions?

Thanks in advance! x

Tagged:

Answers

  • I don't know how I can rename the files so that they can change automatically

    Please check the following link: https://processing.org/reference/saveFrame_.html

    when I try to save just the image on the right (titled imgCopy), this is when the overwrite problem happen

    Taking a wild guess, it could be a flaw in your design. You will need to show your code, or a minimal version reproducing your issue.

    Kf

  • You can have a full dialogue asking for a user input for file name

    Or you will just count up a number and check if the file already exists

    If it doesn't store with that name

    If it does increase number

Sign In or Register to comment.