public  static  Bitmap  RotateImage ( Bitmap  image,  int ) { try { Bitmap  rotatedImage =  new  Bitmap ( image. Height,  image. Width) ; using  ( Graphics  g =  Graphics. FromImage ( rotatedImage) ) { g. TranslateTransform ( rotatedImage. Width /  2 ,  rotatedImage. Height /  2 ) ; g. RotateTransform ( angle) ; g. DrawImage ( image,  - image. Width /  2 ,  - image. Height /  2 ,  image. Width,  image. Height) ; return  rotatedImage; } } catch  ( AccessViolationException  ave) { return  null ; } } public  static  Bitmap  RotateImage2 ( Bitmap  originalImage,  float ) { int =  originalImage. Width; int =  originalImage. Height; double =  angle *  Math. PI /  180.0 ; double =  Math. Abs ( Math. Sin ( radians) ) ; double =  Math. Abs ( Math. Cos ( radians) ) ; int =  ( int ) Math. Floor ( width *  cos +  height *  sin) ; int =  ( int ) Math. Floor ( width *  sin +  height *  cos) ; Bitmap  rotatedImage =  new  Bitmap ( newWidth,  newHeight) ; using  ( Graphics  g =  Graphics. FromImage ( rotatedImage) ) { g. InterpolationMode =  InterpolationMode. HighQualityBicubic; g. SmoothingMode =  SmoothingMode. HighQuality; g. PixelOffsetMode =  PixelOffsetMode. HighQuality; g. CompositingQuality =  CompositingQuality. HighQuality; Point  center =  new  Point ( newWidth /  2 ,  newHeight /  2 ) ; g. TranslateTransform ( center. X,  center. Y) ; g. RotateTransform ( angle) ; g. TranslateTransform ( - center. X,  - center. Y) ; g. DrawImage ( originalImage,  new  Point ( ( newWidth -  width)  /  2 ,  ( newHeight -  height)  /  2 ) ) ; } return  rotatedImage; } public  static  Bitmap  BitmapImage2 ( Bitmap  originalImage) { { Bitmap  flippedImage =  new  Bitmap ( originalImage. Width,  originalImage. Height) ; using  ( Graphics  g =  Graphics. FromImage ( flippedImage) ) { g. DrawImage ( originalImage,  new  Rectangle ( 0 ,  0 ,  flippedImage. Width,  flippedImage. Height) , new  Rectangle ( originalImage. Width,  0 ,  - originalImage. Width,  originalImage. Height) , GraphicsUnit. Pixel) ; } return  flippedImage; } } public  static  Bitmap  BitmapImage ( Bitmap  originalBitmap) { Bitmap  mirroredBitmap =  new  Bitmap ( originalBitmap. Width,  originalBitmap. Height) ; for  ( int =  0 ;  y <  originalBitmap. Height;  y++ ) { for  ( int =  0 ;  x <  originalBitmap. Width;  x++ ) { Color  originalColor =  originalBitmap. GetPixel ( x,  y) ; int =  originalBitmap. Width -  1  -  x; mirroredBitmap. SetPixel ( mirroredX,  y,  originalColor) ; } } return  mirroredBitmap; }