I'm trying following code to scaling image:
public static Image ScaleImage(Image image, int maxWidth, int maxHeight)
var ratioX = (double)maxWidth / image.Width;
var ratioY = (double)maxHeight / image.Height;
var ratio = Math.Min(ratioX, ratioY);
var newWidth = (int)(image.Width * ratio);
var newHeight = (int)(image.Height * ratio);
var newImage = new Bitmap(image, newWidth, newHeight);
//Graphics.FromImage(newImage).DrawImage(image, 0, 0, newWidth, newHeight);
Able to scale the image but in few cases image getting rotated. Checked and found that in the above method some how EXIF data getting lost during drawing new bitmap.
What is the way to keep the rotation of the original images?
Total Marked As Answer: