Broke out common CImg plugin idioms into cimg_common.h