publiclab / mapknitter

Upload your own aerial images, position (rubbersheet) them in a web interface over existing map data, and share via web or composite and export for print.
http://mapknitter.org
GNU General Public License v3.0
267 stars 211 forks source link

exif.js doesn't read orientation tags properly #181

Open jywarren opened 9 years ago

jywarren commented 9 years ago

http://mapknitter.org/maps/gps-test shows several which seem to be off by increments of 90 degrees;

See how this is done in the backend: https://github.com/publiclab/mapknitter/blob/master/app/models/warpable.rb#L231-L242

EXIF orientation values:

Value 0th Row 0th Column
1 top left side
2 top right side
3 bottom right side
4 bottom left side
5 left side top
6 right side top
7 right side bottom
8 left side bottom
jywarren commented 9 years ago

Specifically RIM0342.JPG is wrong, and RIM0352.JPG is right, in the CUAS example.

jywarren commented 9 years ago

So, this is now implemented (a67ff2ad6ebd2022a540017ac6ed5c3b6503e3e1) but is not working properly. exif and exifprobe on Ubuntu correctly identifies the two images above as "3" and "8" -- but exif.js reads both as "1".

$:~/Desktop/gps$ exifprobe RIMG0352.JPG | grep Orientation
@0x000003a=58      :        <0x0112=  274> Orientation                 [3 =SHORT         1]  = 3 = '0,0 is bottom right'
$:~/Desktop/gps$ exifprobe RIMG0342.JPG | grep Orientation
@0x000003a=58      :        <0x0112=  274> Orientation                 [3 =SHORT         1]  = 8 = '0,0 is left bottom'
jywarren commented 9 years ago

Filed an issue here: https://github.com/exif-js/exif-js/issues/45

grvsachdeva commented 5 years ago

@jywarren I noticed there was a update in issue https://github.com/exif-js/exif-js/issues/45. Would you like to update here too? Thanks!

jywarren commented 5 years ago

Hmm do you think it was fixed?

grvsachdeva commented 5 years ago

No @jywarren, the issue is still open.

jywarren commented 5 years ago

I think we'll have to try to help solve it upstream in exif.js. Thanks!

sashadev-sky commented 5 years ago

@jywarren @gauravano I started working looking at the exif data today when looking at your modularization of exporter code PR. Will definitely look into this more.

Just wondering what API are we using exactly? There wasn't much documentation to guide me

jywarren commented 5 years ago

We're probably going to start doing this in Leaflet.DistortableImage as part of @rexagod's new GPS placement API -- see https://github.com/publiclab/Leaflet.DistortableImage/pull/169/ -- although it's still in progress. But It basically uses the Exif.js library to dig GPS tags out of the images, and to auto-place them accordingly!