I'll leave it to others to respond with references to the stdlib and/or other external libs, but I thought I might mention my library since it could potentially be relevant. I've been working on bindings for OpenImageIO, which includes an ImageCache that handles transparently loading tons of images, managing how many files are actually open at any given time, and serving scanlines/tiles on demand.
I can't say I am any kind of authority on OpenImageIO yet, as my primary purpose for creating the bindings was to have support for common file formats to Visual Effects like EXR, as well as integrated support with OpenColorIO for studio color pipelines. But the oiio library does offer quite a lot of support for efficient reading/writing in terms of scanline/tile/subimage of large/many images.
Document ref (and possibly section "7 Cached Images" to be specific):
OpenImageIGO bindings:
Still working on completing them, but I have a good majority of it done so far.
-- justin