I have developed two actions here, one for a flattened or original image, while the other will work on a multi-layered image.
Let me know how it goes
I have written a tutorial here:
[link] if you want a break down of the action.
Please read the rules:
[link]