0

I am trying to save an image here but its getting rotated when its saved. The current code for this is like this :

filepath is the path to a a vertical image (width < height)

using (Image img = Image.FromFile(filePath))
                {
                    img.Save(savePath + Path.GetFileNameWithoutExtension(filePath) + ".bmp", ImageFormat.Bmp);

            }

After the code is run, when I check the new image that is saved, it is rotated 90 degree counterclockwise. I am unable to understand this behaviour

Suggestions and guidance on how to prevent this would be appreciated.

Dhrumil
  • 3,221
  • 6
  • 21
  • 34
Alejandro Lozdziejski
  • 1,063
  • 4
  • 12
  • 30
  • At a guess your original file is a JPEG that contains an EXIF tag to rotate it to the proper orientation. I suspect the .NET library is ignoring this tag. – Phylogenesis Apr 28 '15 at 15:06
  • 1
    Or [this question](http://stackoverflow.com/questions/6222053/problem-reading-jpeg-metadata-orientation). – Phylogenesis Apr 28 '15 at 15:08

0 Answers0