In an environment with limited resources, I believe that your only solution is to divide and win: for example. caching / tile (as in: tile)
Instead of loading and processing the image, you immediately load / save managed image chunks from the raw data file to perform your processing. This is not trivial and can become really complicated depending on the type of processing you want to do, but this is the only way if you do not want to include in the image quality.
source share