Taking images from continuous classification

Hi I am building an app that has to recognize if the image from the camera is totally black or even partially of another color. If it finds another color i wanted it to save that image (i will do more with the image later). Is it possible in the moment the PIC recognize this take the frame as an image on his own?

Screenshot 2024-06-04 223242
The important part is where it says to the webviewer to stop loading, in that part i wanted to save the image.