how to clean an image (for different setContext operation)?

Hi, I’d like to use the same image as destination for different setContext operation but I don’t know how to clean previous setContext results, and I fear that the only solution would be to manually set pixel per pixel value.

Does it exist a fast way to clean all the pixels and restore the image as it was when just created?

You could use

setContext(myimage)
background(0,0,0,0)
setContext(nil)

Failing that, reallocing the image will be faster than manually setting pixels:

myimage = image(myimage.width,myimage.height)

Hi, thanks, the background call works properly and that’s exactly what I needed, it’s just taht I was sure to have already tried it but obviously I did something wrong before :slight_smile: