To rephrase the question:
If we have images dst.png and out.png, and we know that out.png came from
Code: Select all
convert dst.png src.png -compose HardLight -composite out.png
... we want to find src.png. Is that correct?
If you knew src.png and wanted to find dst.png, this would be quite simple. One of two formulae are used, depending on the value of src, and both the formulae are reversible.
The two formulae are:
Code: Select all
out = 2*src*dst
out = 1 - 2*(1-src)*(1-dst)
But you don't know src, so don't know for each pixel which formula is used.
I think you could assume one of the formulae, and try the reverse of that. This gves you a version of src.png. Use this with HardLight, and compare the result with your initial out.png. Some of the pixels will be wrong, so those had the wrong formula, so recalculate those pixels with the inverse of the other formula.
But there may be a simpler method.