Correctly modify image data when applying display transform
QImage::bits() detaches so we are not modifying the existing image data when doing the transform but rather modifying a copy. So ensure we do not detach.
Note that this is a really ugly solution that works but leads to some potential issues, primarily it means we now use transformed image data on save. On the other hand, the color profile of saved images is not preserved anyway so either way is incorrect.