fix gpsaltituderef

This commit is contained in:
Stefal 2023-09-12 14:56:14 +02:00
parent 6989b5e0d9
commit 0674be2712
2 changed files with 2 additions and 4 deletions

View File

@ -4,7 +4,6 @@ import os
import asyncio import asyncio
import argparse import argparse
from datetime import datetime from datetime import datetime
from lib.exif_write import ExifEdit
import writer import writer
from model import PictureType from model import PictureType

View File

@ -82,8 +82,8 @@ def add_altitude(picture: bytes, metadata: PictureMetadata, precision: int = 100
img = pyexiv2.ImageData(picture) img = pyexiv2.ImageData(picture)
updated_exif = {} updated_exif = {}
if metadata.altitude is not None: if altitude is not None:
negative_altitude = '0' if altitude >= 0 else '1' negative_altitude = 0 if altitude >= 0 else 1
updated_exif['Exif.GPSInfo.GPSAltitude'] = f"{int(abs(altitude * precision))} / {precision}" updated_exif['Exif.GPSInfo.GPSAltitude'] = f"{int(abs(altitude * precision))} / {precision}"
updated_exif['Exif.GPSInfo.GPSAltitudeRef'] = negative_altitude updated_exif['Exif.GPSInfo.GPSAltitudeRef'] = negative_altitude
@ -107,7 +107,6 @@ def add_direction(picture: bytes, metadata: PictureMetadata, ref: str = 'T', pre
if updated_exif: if updated_exif:
img.modify_exif(updated_exif) img.modify_exif(updated_exif)
print(updated_exif)
return img.get_bytes() return img.get_bytes()