dim function for image load fast