added more flexible image rendering