slight refactoring of ImgOp