Scan image - pixel format

I can’t see where I can read an image pixel by pixel?! Like for taking an image and having it slowly come apart.

If your image has been rendered, SDL_RenderReadPixels() will read individual pixels, but it’s slow. You will probably want to read the entire image to a buffer and then access the individual pixels there (still slow, but less so).

If your image hasn’t been rendered, then of course accessing its pixels will depend on how that image is stored, for example as a surface or a texture.

I would like a minimal example? With, like, what to cast void* to.