prepare code for loading image