Moustikitos / tyf

Manipulate EXIF and IFD metadata.
19 stars 8 forks source link

location_dump doesnt not work sometimes #3

Closed spacemishka closed 8 years ago

spacemishka commented 8 years ago

Hello,

at first thanks for this library!!!

But i have little problem with some images. I wrote a script to add EXIF-Tags with GPS to Images which don't have any. This works ok as far i can see

part of script:

        img = Image.open(os.path.join('pictures', filename))
        exf = img._getexif()
        exf[0]['GPSLatitude'] = lpi[2]
        exf[0]['GPSLongitude'] = lpi[1]
        exf[0]['GPSAltitude'] = 0.00
        exf[1]['GPSLatitude'] = lpi[2]
        exf[1]['GPSLongitude'] = lpi[1]
        exf[1]['GPSAltitude'] = 0.00
        img.save(os.path.join('tagged', 'tagged_' + filename), ifd=exf)

but jpg.exif.dump_location doesnt create images of location. For any photo taken with my Iphone which adds GPS-Tags automatically it works.

What did i miss??

Thanks Peter

Moustikitos commented 8 years ago

Hello Peter,

  1. make sure you use Tyf.Image class
  2. you have to initiate "GPSLatitudeRef" and "GPSLongitudeRef" tags

exf[0]['GPSLatitude'] = exf[0]['GPSLatitudeRef'] = lpi[2] exf[0]['GPSLongitude'] = exf[0]['GPSLongitudeRef'] = lpi[2] exf[0]['GPSAltitude'] = 0.00

No need to do it with exf[1] that is JPEG thumbnail actually

thanks for using my lib

spacemishka commented 8 years ago

thanks! Now it's working:)