Code cleanup in CustomImageEx.cpp