public void RotateQueryImage(double theta) { var rotatedImage = ImageEditor.RotateImage(this.DownloadedImageUri.LocalPath, (float)(-1.0 * theta)); this.IsQueryImageModified = true; this.TransformedImageUri = new Uri(rotatedImage); }
public static string RotateImage(string srcImageFile, float theta) // This method handles the location of an image loaded from the internet { if (theta == 0.0) // If there's no rotation needed, just output the original image { return(srcImageFile); } using (var srcBitmap = new Bitmap(srcImageFile)) // Create a new rotated version of the image { var rotatedBitmap = ImageEditor.RotateImage(srcBitmap, theta); var retValString = Path.GetTempFileName(); rotatedBitmap.Save(retValString, ImageFormat.Jpeg); rotatedBitmap.Dispose(); return(retValString); } }