added code for indexed images