commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
982 stars 1.18k forks source link

Samsung versus Exif location #5081

Open jidanni opened 1 year ago

jidanni commented 1 year ago

Samsung Galaxy users often find they are not able to transmit location data in the Exif headers so the Commons App can deal with it properly.

Screenshot_20221021-195033_Commons.jpg

For example: https://commons.m.wikimedia.org/wiki/File%3AInternational_boundary_line_plaque_Rainbow_Bridge_Niagara_Falls.jpg

Samsung's Gallery app certainly knows where it is: Screenshot_20221021-200208_Gallery.jpg

So perhaps maybe indeed it is stuffing actual ASCII text of the street address, where latitude and longitude was supposed to be, there in Exif... https://us.community.samsung.com/t5/Galaxy-S22/GPS-location-coordinates-not-entered-into-photo-Exif-file/td-p/2248843

Anyway perhaps the Commons error message should give more guidance, seeing as Samsung is a heavy player in the cell phone market.

Oh and by the way many Samsung users choose the .heic format to save space. But that proprietary format cannot be uploaded to Wikimedia. So we first do this conversion, Screenshot_20221021-200142_Photo Editor.jpg to .jpg. (One must select 80%, or else no conversion will occur.)

Anyway I'm sure many of the staff reading this bug report have Android 12 and Samsung Galaxy and have the same problem.

So perhaps some official guidance could be created. "Do not use the Samsung camera app", or "only take pictures directly via the MediaWiki app", etc. etc.

nicolas-raoul commented 1 year ago

Could you please upload an original JPEG taken by your camera having text EXIF location to http://exif-viewer.com/ and copy/paste the full result here? Please also share the JPG before sneding to Commons, as a shared Google Drive link for instance.

Also, could you please create a separate issue for HEIC, including a link to a HEIC file produced by your camera, shared like above. Thanks!

jidanni commented 1 year ago

First, that site raises a browser error even before you get to it ... you have to push advanced settings to proceed to it anyway. Second when I paste https://upload.wikimedia.org/wikipedia/commons/6/65/International_boundary_line_plaque_Rainbow_Bridge_Niagara_Falls.jpg in to it even more SSL errors occur...

jidanni commented 1 year ago

OK, https://jimpl.com/results/mQGrqQF6vib8h6iNAUB97aUD?target=exif says

GPSAltitude
undef
GPSAltitudeRef
Above Sea Level
GPSLatitudeRef
Unknown ()
GPSLongitudeRef
Unknown ()
jidanni commented 1 year ago

Anyway, users would be expected to always choose .heic mode because it saves half the disk space, and will not be taking pictures in .jpg mode just to support some legacy apps...

Strubbl commented 1 year ago

Could you please upload an original JPEG taken by your camera having text EXIF location to http://exif-viewer.com/ and copy/paste the full result here? Please also share the JPG before sneding to Commons, as a shared Google Drive link for instance.

Also, could you please create a separate issue for HEIC, including a link to a HEIC file produced by your camera, shared like above. Thanks!

I can reproduce the problem with pictures taken with a Samsung S9 or S22. E.g. the following JPEG: https://cloud.linux4tw.de/index.php/s/BZXKECKDiqfyMJP

Exif Result is:

create 2022-10-29T22:53:15+00:00
ApertureValue 169/100
BrightnessValue 903/100
ColorSpace 1
Compression 6
DateTime 2022:10:28 16:33:29
DateTimeDigitized 2022:10:28 16:33:29
DateTimeOriginal 2022:10:28 16:33:29
DigitalZoomRatio 100/100
ExifImageLength 3000
ExifImageWidth 4000
ExifOffset 238
ExifVersion 48, 50, 50, 48
ExposureBiasValue 0/100
ExposureMode 0
ExposureProgram 2
ExposureTime 1/990
Flash 0
FNumber 180/100
FocalLength 540/100
FocalLengthIn35mmFilm 23
GPSAltitude 573/1
GPSAltitudeRef 0
GPSInfo 696
GPSLatitude 48/1, 6/1, 3668039/1000000
GPSLatitudeRef N
GPSLongitude 11/1, 37/1, 45991919/1000000
GPSLongitudeRef E
ImageLength 3000
ImageUniqueID D50XLOD00PM
ImageWidth 4000
ISOSpeedRatings 50
JPEGInterchangeFormat 948
JPEGInterchangeFormatLength 47556
Make samsung
MaxApertureValue 169/100
MeteringMode 2
Model SM-S901B
Orientation 1
ResolutionUnit 2
SceneCaptureType 0
ShutterSpeedValue 995/100
Software S901BXXS2AVI7
WhiteBalance 0
XResolution 72/1
YCbCrPositioning 1
YResolution 72/1
modify 2022-10-29T22:53:15+00:00
ApertureValue 169/100
BrightnessValue 903/100
ColorSpace 1
Compression 6
DateTime 2022:10:28 16:33:29
DateTimeDigitized 2022:10:28 16:33:29
DateTimeOriginal 2022:10:28 16:33:29
DigitalZoomRatio 100/100
ExifImageLength 3000
ExifImageWidth 4000
ExifOffset 238
ExifVersion 48, 50, 50, 48
ExposureBiasValue 0/100
ExposureMode 0
ExposureProgram 2
ExposureTime 1/990
Flash 0
FNumber 180/100
FocalLength 540/100
FocalLengthIn35mmFilm 23
GPSAltitude 573/1
GPSAltitudeRef 0
GPSInfo 696
GPSLatitude 48/1, 6/1, 3668039/1000000
GPSLatitudeRef N
GPSLongitude 11/1, 37/1, 45991919/1000000
GPSLongitudeRef E
ImageLength 3000
ImageUniqueID D50XLOD00PM
ImageWidth 4000
ISOSpeedRatings 50
JPEGInterchangeFormat 948
JPEGInterchangeFormatLength 47556
Make samsung
MaxApertureValue 169/100
MeteringMode 2
Model SM-S901B
Orientation 1
ResolutionUnit 2
SceneCaptureType 0
ShutterSpeedValue 995/100
Software S901BXXS2AVI7
WhiteBalance 0
XResolution 72/1
YCbCrPositioning 1
YResolution 72/1
colorspace 2
ApertureValue 169/100
BrightnessValue 903/100
ColorSpace 1
Compression 6
DateTime 2022:10:28 16:33:29
DateTimeDigitized 2022:10:28 16:33:29
DateTimeOriginal 2022:10:28 16:33:29
DigitalZoomRatio 100/100
ExifImageLength 3000
ExifImageWidth 4000
ExifOffset 238
ExifVersion 48, 50, 50, 48
ExposureBiasValue 0/100
ExposureMode 0
ExposureProgram 2
ExposureTime 1/990
Flash 0
FNumber 180/100
FocalLength 540/100
FocalLengthIn35mmFilm 23
GPSAltitude 573/1
GPSAltitudeRef 0
GPSInfo 696
GPSLatitude 48/1, 6/1, 3668039/1000000
GPSLatitudeRef N
GPSLongitude 11/1, 37/1, 45991919/1000000
GPSLongitudeRef E
ImageLength 3000
ImageUniqueID D50XLOD00PM
ImageWidth 4000
ISOSpeedRatings 50
JPEGInterchangeFormat 948
JPEGInterchangeFormatLength 47556
Make samsung
MaxApertureValue 169/100
MeteringMode 2
Model SM-S901B
Orientation 1
ResolutionUnit 2
SceneCaptureType 0
ShutterSpeedValue 995/100
Software S901BXXS2AVI7
WhiteBalance 0
XResolution 72/1
YCbCrPositioning 1
YResolution 72/1
sampling-factor 2x2,1x1,1x1
ApertureValue 169/100
BrightnessValue 903/100
ColorSpace 1
Compression 6
DateTime 2022:10:28 16:33:29
DateTimeDigitized 2022:10:28 16:33:29
DateTimeOriginal 2022:10:28 16:33:29
DigitalZoomRatio 100/100
ExifImageLength 3000
ExifImageWidth 4000
ExifOffset 238
ExifVersion 48, 50, 50, 48
ExposureBiasValue 0/100
ExposureMode 0
ExposureProgram 2
ExposureTime 1/990
Flash 0
FNumber 180/100
FocalLength 540/100
FocalLengthIn35mmFilm 23
GPSAltitude 573/1
GPSAltitudeRef 0
GPSInfo 696
GPSLatitude 48/1, 6/1, 3668039/1000000
GPSLatitudeRef N
GPSLongitude 11/1, 37/1, 45991919/1000000
GPSLongitudeRef E
ImageLength 3000
ImageUniqueID D50XLOD00PM
ImageWidth 4000
ISOSpeedRatings 50
JPEGInterchangeFormat 948
JPEGInterchangeFormatLength 47556
Make samsung
MaxApertureValue 169/100
MeteringMode 2
Model SM-S901B
Orientation 1
ResolutionUnit 2
SceneCaptureType 0
ShutterSpeedValue 995/100
Software S901BXXS2AVI7
WhiteBalance 0
XResolution 72/1
YCbCrPositioning 1
YResolution 72/1
nicolas-raoul commented 1 year ago

@jidanni and @Strubbl what Android versions are you using?

Strubbl commented 1 year ago

Stock Android 12.

nicolas-raoul commented 1 year ago

This happens with the custom picker, the normal picker, as well as sharing from gallery?

Actually on a recent Android version the only way I have found to get the location recognized is to first look at the picture's location in Google Photos' details, then share to Commons.

Strubbl commented 1 year ago

@jidanni and @Strubbl what Android versions are you using?

The Samsung S9 runs Stock Android 10

Strubbl commented 1 year ago

This happens with the custom picker, the normal picker, as well as sharing from gallery?

Yes, i tried it directly with the picker from the app as well as sharing from gallery. Both ways do not recognize the location.

Actually on a recent Android version the only way I have found to get the location recognized is to first look at the picture's location in Google Photos' details, then share to Commons.

I cannot test this due to not having Google Photos available. But this reads like GPhotos is changing some location exif data at the file.

jidanni commented 1 year ago

Observation: reboot the Samsung phone, totally in airplane mode.

Looking in the Samsung Gallery app, in the Details page of each photograph, we see each picture has gone back to latitude and longitude. This gives us a glimmer of cheer. So those geocoded street addresses, are just a temporary phenomenon... So deep down latitude and longitude are still inside the photographs. It's only when the Samsung Gallery app gets a sniff of the network then it starts showing street addresses, which it'll show until the next reboot.

jidanni commented 1 year ago

Hmmm, maybe Samsung is not to blame, and something else zapped the GPS stuff.

identify -verbose /tmp/x.jpg|egrep -i gps\|sams
    exif:GPSAltitude: 184/1
    exif:GPSAltitudeRef: 0
    exif:GPSInfo: 652
    exif:GPSLatitude: 42/1, 9/1, 57845879/1000000
    exif:GPSLatitudeRef: N
    exif:GPSLongitude: 87/1, 46/1, 56663760/1000000
    exif:GPSLongitudeRef: W
    exif:Make: samsung
wget https://upload.wikimedia.org/wikipedia/commons/9/96/Boundary_detail_on_Niagara_Falls_International_Rainbow_Bridge.jpg
$ identify -verbose Boundary_detail_on_Niagara_Falls_International_Rainbow_Bridge.jpg |egrep -i gps\|sams
    exif:GPSAltitude: 0/0
    exif:GPSAltitudeRef: 0
    exif:GPSInfo: 599
    exif:GPSLatitude: 0/0, 0/0, 0/0
    exif:GPSLatitudeRef: 
    exif:GPSLongitude: 0/0, 0/0, 0/0
    exif:GPSLongitudeRef: 

(exif:GPSInfo is what isn't clear.)

Strubbl commented 1 year ago

It worked with an older version of the app, which i had installed via F-Droid back then, e.g. with Android-App Commons 2.11.0~93b948d20 (info from this picture: https://commons.wikimedia.org/wiki/File:Rathaus_Stralsund_3.8.2019.jpg)

It might already have stopped working with with version 3.1.1~1c9267ca0.

nicolas-raoul commented 1 year ago

Very interesting! If someone could post the F-Droid links to the last working version and the first broken version, that would be super useful. 🙂

Strubbl commented 1 year ago

Unfortunately, this is not possible anymore. The version 3.1.1~1c9267ca0 was installed from Gplay, because the latest available version on F-Droid is 2.6.0. I installed this 2.6.0, but it crashes directly after logging in. I cannot remember this exactly anymore. But i think due the versions mentioned, i installed the app from Google Play, because the F-Droid version was never working for me.

jidanni commented 1 year ago

By the way, https://play.google.com/store/apps/details?id=com.aminbeheshti.exifviewer is a fine Exif analyzer.

Strubbl commented 1 year ago

Using the upload wizard in https://commons.wikimedia.org/w/index.php?title=Special:UploadWizard with a Desktop PC detects the location. Using the same wizard with Firefox on Android does not work to detect the location.