f2calv / CasCap.Apis.GooglePhotos

*unofficial* Google Photos REST API library for .NET projects.
MIT License
58 stars 10 forks source link

DownloadBytes does not preserve exif data #98

Closed christiantsunami closed 1 year ago

christiantsunami commented 2 years ago

It would be nice if the DownloadBytes would preserve the exif data, it currently does not, This can be accomplished by adding the "ip" parameter to the url you are creating to download the media item. (Found the info here https://gist.github.com/Sauerstoffdioxid/2a0206da9f44dde1fdfce290f38d2703)

https://github.com/f2calv/CasCap.Apis.GooglePhotos/blob/0c8f744a228f9985ea010f356d2d3adcd4525a19/src/CasCap.Apis.GooglePhotos/Services/GooglePhotosService.cs#L66

f2calv commented 2 years ago

Thanks for raising this, it would appear that my current implementation has an issue;

if (downloadPhoto || qs.Count == 0) qs.Add("d");

According to the docs (search the page for 'EXIF') I should concatenate the baseUrl with =d except I'm adding it to the URL as a QueryString parameter instead.

I will have more time next week to look into this and run some tests and will update the library accordingly.

pcartwright81 commented 2 years ago

This query looks good as shown by the screenshot with baseUrl=d. All my images downloaded from the API have EXIF metadata. image Adding -ip did not give a different result from what I can tell. Location metadata is not available. image Below are the list of the issues with the Google Photos API gathered on another repo. https://github.com/gilesknap/gphotos-sync/discussions/359

f2calv commented 1 year ago

So I added a bunch of EXIF tests here and can confirm that the original query is correct. Yes sadly Google strips the latitude/longitude data when the bytes are returned.