If that's the purpose, couldn't you store the hash and throw away the compressed image?
(As others said, compression is deterministic for the same algorithm, parameters and input data)
(As others said, compression is deterministic for the same algorithm, parameters and input data)
Tar isn't related here though, we're talking about compression not archival formats