Can you tell (say, using .NET 4.0, WinForms) if a JPEG image is rotated only from its binary file (for example, the result of File.ReadAllBytes() )?
UPDATE
Thank you all for your answers.
Just a heads-up for anyone trying to solve the same problem. I was tricked by the System.Drawing.Image class, which loads EXIF tags when initializing with FromFile(...) , but seems to ignore them when initializing from a stream. I used the ExifTagCollection library to read EXIF tags, but I think the results will be comparable to any other library.
var bytes = (get binary from server) File.WriteAllBytes(path, bytes);
WORKS :
var image = Image.FromFile(path);
DOES NOT WORK : (not executed for FileStream )
using (var ms = new MemoryStream(bytes)) { image = Image.FromStream(ms); }
Continuation:
ExifTagCollection exif = new ExifTagCollection(image); foreach (ExifTag tag in exif) { Console.WriteLine(tag.ToString()); }
no tags when loading from stream.
source share