changed crop function to reallocate pixels and use memcpy. fixes #3346

fix for #3346, please test.
I found that the crop function uses std::swap to copy the cropped pixels into the current object's pixels array, however I believe this was actually just swapping the pointers to the pixels arrays, leading to the run-time error after the local variable 'crop' gets deallocated, and is subsequently accessed within the swapRgb function