I have written a simple tool to decompress background images in SCUMM V5 games, you can find it on my website (called "SCUMM Image Encoder (mi2img)"). It has Python source code available. SCUMM V5 has multiple methods for compressing the backgrounds. It only compresses in the "lossless" format.
It requires certain blocks extracted from the resource file, you can get these blocks using either ScummPacker (also on my site) or scummrp (from elsewhere).
Also, check out the source code for the incomplete tool ScummEx, available in the ScummVM repositories.