Skip to content

How to use this lib to get the photo’s orientation

unstoppable edited this page Jun 10, 2012 · 1 revision

How to use this lib to get the photo’s orientation:

  1. import flash.utils.ByteArray;

  2. import fox.photo.SimpleExifExtractor;

  3. import fox.photo.exif.ifd.IFDValue;

  4. import fox.photo.jpeg.Exif;

  5. var orientation:int = -1;

  6. var orientationId:int = 274;// in Exif2-2.PDF document, the orientation id is 274

  7. var bytes:ByteArray = PhotoData;

  8. var exif:Exif=SimpleExifExtractor.readExif(bytes);

  9. var tag:IFDValue=exif.findTagById(orientationId);

  10. if (tag) // in certain case, it might don’t have orientation infomation.

  11. {

  12. orientation=parseInt("" + tag.value);

  13. }

  14. trace('orientation is:'+orientation);

Clone this wiki locally