solving the problem of picture out of memory