Generalized to any iumage type