But if you really have to back up the disk image, dd a copy of it, mount the copied image as loopback device, write the loopback filesystem full of /dev/zero, sync, delete the zero file(s), unmount, cp --sparse=always and store the result.
The reason for using the loopback image step is to prevent wearing out the SD card with writing the free space full of zeros every time you make a backup.
There may be an existing tool for this, but I don’t remember it.