Is there a way encode/decode portion of a huge Image?

if there is a huge image(10000x10000), loading it into memory will cause crash every time.

so, can I load a portion of image into memory and process it, and write back this part to image file?

Is there a way encode/decode portion of a huge Image?
 
 
Q