add read image function - stable version