In this answer described how to get picture from two images so intersection (common part of them) will be coloured black — https://stackoverflow.com/a/31258083/4767232
How can I get this result not as picture but as a rect (e.g. left=100, top=50, bottom=200, right=300)?