Removes counting layers to apply 'flatten' function

Hello,

I've got an issue where I need to flatten an alpha channel against a white background of an image with a single layer.

See http://www.wizards-toolkit.org/discourse-server/viewtopic.php?f=3&t=20234#p80257 for more explanations.

One possible way to do that is to remove the check of counting layers to apply the function as if you apply the flatten option on a image with one layer it will not interfer at all.

We could also check if the image has an alpha channel (if it is possible with PHP Imagick) then authorize the appliance of the flatten function.
Instead of comparing files checksum, I'd prefer to check a transparent / colored background using imagine API. Is it doable ?