added max image size to prevent OOME