I'm reading an image file and rescaling it to send it to a server. In order to properly rescale it I need to change the orientation, since some pictures are taken with a mobile device camera. In order to do this rotation I did the following using the exif.js library:
EXIF.getData(img, function() {
alert(this.exifdata.Orientation);
orientation = this.exifdata.Orientation;
alert(orientation);
}
If this.exif.data.Orientation
was, for example 6, the following output would be desierd: "6", "6".
This works when a file is uploaded via my computer. However, when uploaded from a mobile device camera, the output is "6" and then "0", no matter what value orientation
had before.
Why does this happen?
Note: I'm only running on one thread. So the variable could not have been set externally during execution of these lines.