As tfguy44 said, avoid loading the image in draw(), because accessing such file 60 times per second isn't necessary / useful, it can only slow down your sketch.
You can load it in setup(), even more as img is already a global variable.
I see you save this image (in the same location? not sure...) on keyPressed(), so you might need to reload it at the same time (although I fail to see why you go through a file, something like PImage.copy() or PImage.get() can do the same thing faster).
I am not too sure of what you want to do: keep an history of the colors? Only keep the latest?
In the second case, a simple saveStrings() can do the job too.
You can load it in setup(), even more as img is already a global variable.
I see you save this image (in the same location? not sure...) on keyPressed(), so you might need to reload it at the same time (although I fail to see why you go through a file, something like PImage.copy() or PImage.get() can do the same thing faster).
I am not too sure of what you want to do: keep an history of the colors? Only keep the latest?
In the second case, a simple saveStrings() can do the job too.