Is it possible to get Orientation from EXIF
I think I can get Author and other fields, but there is no property for Orientation.
JpegBitmapDecoder dec = new JpegBitmapDecoder(new Uri(""), BitmapCreateOptions.None, BitmapCacheOption.None);string author = dec.Metadata.Author;
I want to automatically rotate my photos and I don't want to recompress JPEG. Should I do something special to achieve this or do JPEG decoder and encoder handle this for me by default
Thanks very much for any answer.
Vojta

JPEG "Orientation" from EXIF for automatic rotation
TomWP
Yes, we’re working with the SDK team to get these types of things document (and hopefully with samples as well!).
Let us know if you need any additional help,
Robert.
dummie_q
quargel
i'm seeing the same issue. _image.Metadata and _decoder.Metadata are both null.
public class Photo { private BitmapImage _image = null; private BitmapDecoder _decoder = null; public Photo() { } public Photo( string path ) { this.Path = path; } private string _path = ""; public string Path { get { return _path; } set { _path = value; if(_path != "") { _image = new BitmapImage(new Uri(_path)); _decoder = BitmapDecoder.Create(new Uri(_path), BitmapCreateOptions.None, BitmapCacheOption.OnLoad); } else { _image = null; _decoder = null; } } } [XmlIgnore] public string Title { get { if(_image != null && _image.Metadata != null) { return (_image.Metadata as BitmapMetadata).Title; } return "<untitled>"; } } [XmlIgnore] public string Size { get { if( _image != null ) { StringBuilder sb = new StringBuilder(); sb.Append(_image.PixelWidth); sb.Append(" x "); sb.Append(_image.PixelHeight); return sb.ToString(); } return "unknown"; } } [XmlIgnore] public string Date { get { if(_image != null && _image.Metadata != null) { return (_image.Metadata as BitmapMetadata).DateTaken; } return "unknown"; } } [XmlIgnore] public string Format { get { if(_image != null && _image.Metadata != null) { return _image.Format.ToString(); } return "unknown"; } } }Pacowar
JpegBitmapDecoder dec = new JpegBitmapDecoder(new Uri(""), BitmapCreateOptions.None, BitmapCacheOption.None);
string author = dec.Metadata.Author;
if (dec.Metadata.ContainsQuery(@”/app0/ifd/exif/orientation”))
{
Object orientation = dec.Metadata.GetQuery(@”/app0/ifd/exif/orientation”);
}
Robert.
Tobbeswim
Thanks!
mchastant
Thank you for you answer it is very useful. Will this be included in documentation
But now I have problem even with Author, because dec.Metadata is null. Should I do anythink else to obtain Metadata Or is this implemented in November CTP
Thank you
Vojta