image is only set when index changes, saving lots of memory allocations