rotate image with in place solution and some tips