Hi,
I am not an expert on Imagemagick tool, but i can do things with bash script. I know there are commands in ImageMagick, like composite, identify, convert to do the things for your requirement.
You can refer my profile and if interested please ping me.
Thank You