Cache: don’t allocate images before calling recursions on input images