public ImageInfo GetTransformedImage(Orientation index) { Transform transform = TransformFromOrientation(index); TransformedBitmap result = new TransformedBitmap((BitmapSource)fSystemImage, transform); return(new ImageInfo(result)); }
public Transform TransformFromOrientation(Orientation orientation) { var transform = new TransformGroup(); if (orientation.Value > 3) { transform.Children.Add(new ScaleTransform(-1, 1)); } switch (orientation.Value & 3) { case 1: transform.Children.Add(new RotateTransform(90D)); break; case 2: transform.Children.Add(new RotateTransform(180D)); break; case 3: transform.Children.Add(new RotateTransform(270D)); break; default: // No rotation break; } return(transform); }
public Orientation GetThumbnailOrientation() { var res = Metadata.Read("Tumbnail.Orientation"); if (res != null) { return(Orientation.FromExif((int)(UInt16)res)); } else { return(new Orientation()); } }