Skip to content

Commit aee14bc

Browse files
authored
fix(android): use rational format for GPS double tags on write (#28)
ExifInterface expects GPS rational values in numerator/denominator format. Writing plain decimal strings caused GPS doubles like GPSDOP, GPSImgDirection, GPSSpeed, etc. to silently fail to persist.
1 parent da64624 commit aee14bc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

android/src/main/java/com/lodev09/exify/ExifyModule.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ class ExifyModule(
133133

134134
ReadableType.Number -> {
135135
when (valType) {
136-
"double" -> exif.setAttribute(tag, tags.getDouble(tag).toBigDecimal().toPlainString())
136+
"double" -> {
137+
val value = tags.getDouble(tag)
138+
if (tag.startsWith("GPS")) {
139+
exif.setAttribute(tag, ExifyUtils.decimalToRational(value))
140+
} else {
141+
exif.setAttribute(tag, value.toBigDecimal().toPlainString())
142+
}
143+
}
137144
else -> exif.setAttribute(tag, tags.getDouble(tag).toInt().toString())
138145
}
139146
}

0 commit comments

Comments
 (0)