improve image alloc