Andy
private void ProcessFile( FileInfo fi )
{ Bitmap bmp = new Bitmap( fi.FullName ); EXIFextractor exif = new EXIFextractor( ref bmp, "\n" ); if ( exif["Orientation"] != null ) { string orientation = exif["Orientation"].ToString( ); RotateFlipType rotateFlipType = OrientationToFlipType( orientation ); if ( rotateFlipType != RotateFlipType.RotateNoneFlipNone ) { //rotate the image bmp.RotateFlip( rotateFlipType ); if ( chkUpdateOrientationProperty.Checked ) { try { //reset the orientation flag exif.SetOrientationTag( 1 ); } catch { } } //save the image string newFileName = ( chkRotateOriginals.Checked ) ? fi.FullName : SaveAsFileName( fi ); bmp.Save( newFileName, ImageFormat.Jpeg ); } } else { } bmp.Dispose( ); }
bmp.RotateFlip( rotateFlipType );