Image rendering function