Tools to optimize animations by collapsing "similar" (not only identical) frames

Hi,
I am trying to go further with the optimization of frame animations.
I use Texture Packer to create the spritesheets, and it offers the option to collapse identical frames, but I think it is not enough, because the frames need to be 1:1 pixel identical, but it looks a big limitation to me.

My idea is: how cool would be if we had a tool in which you define a tolerance to collapse “pretty similar” frames? It should compare a frame with the other ones, see if the difference is tolerable (based on user settings) and replace the similar frames with the other ones, so Texture Packer could easily collapse them as identical.
Photoshop can compare images, but I can’t find any script to make it automatically.

Do you know if such a tool exists?

Does an exporter such as Spine or DragonBones help with similar frames, for example, when only a transform is slightly different?

I am thinking of pre-rendered 2d-3d frames, that artists send us.