Optimize image copy with memcpy instead of std::copy