This is my initial take on this issue. Of course there is still a bit left to do so I do not expect this to be accepted as is.
First of all, perhaps we should merge use_alpha and alpha_mode into one enum flag?
IE:
0 = !use_alpha 1 = use_alpha && strait 2 = use_alpha && pre...
If not, where should I add the enums for alpha_mode?
I also noticed that a check in image.cpp seems redundant as it will never trigger (?). I've marked it as TODO
Additionally, this patch doesn't work with packed images. Is the cycles textures not reloaded properly?