Added log + realloc for png/jpg load