Saving large mosaic-style images (OutOfMemory issue)

Hey all! I’ve been working on a 2-D tile based map editor and it is at the point now where it works well enough. I am now adding the ability to save the produced image and it works; however, if the map size is too big I obviously receive an OutOfMemory error. I was wondering if there was a way I could save the image tile by tile so I don’t have to keep the whole image stored in memory at once. Does anyone know of a method or library that would support this? Thanks!

I’m pretty sure you need to have the whole image stored in memory to be able to save it to disk especially if you’re doing any kind of compression. Either save it as a multiple images or, well, just increase the heap size?