beaufour / flickr-download

Tool for downloading sets and photos from Flickr
Apache License 2.0
231 stars 65 forks source link

Choose Original over other formats if there's a choice between the largest size #74

Closed zanna-37 closed 1 year ago

zanna-37 commented 1 year ago

I noticed that when not specifying --quality SIZE_LABEL, the code tries to get the larger one. However, I don't think this is the best way because you'll probably end up with a file that is larger than the original (!) and without much or its metadata (EXIF). A better approach would be to download the Original.

What do you think?

beaufour commented 1 year ago

Hmm, I would be surprised if Flickr upscaled your images after upload? The code does indeed pick the largest available photo size. That should be the original one, unless that's not available I would think. I just rely on the underlying flickr API code here if you are interested in seeing the logic: https://github.com/alexis-mignon/python-flickr-api/blob/132304ccd9fc3012db29fdf0762896402f814500/flickr_api/objects.py#L1254

zanna-37 commented 1 year ago

I opened this because the photo I got without specifying the size was not the original, and when I specifically queried the original I found out it was just slightly smaller. Sadly, enough to fool the corrent system.

beaufour commented 1 year ago

Hmm. Is it a public photo so I can see the behavior myself?

zanna-37 commented 1 year ago

Sure, I'll send it to you by email. By the way, I was slightly wrong, they are the same size, still the default one is not the Original. You can check that by comparing the EXIFs.

Original is 2.140.609 byte and has an EXIF field with "Canon EOS 5D Mark IV". Default one is 1.978.924 byte and has way less EXIF fields.

zanna-37 commented 1 year ago

The code you referenced updates the "largest_size" only if the current photo is larger than the largest-so-far. Since the Original and the 5K-one are both of the same size, the first one of the list wins. I personally think that the code should prefer the one with the label "Original" and fallback to the largest only when the original cannot be found.

beaufour commented 1 year ago

I'll be damned. You are right. We should definitely fix that. I'll try to find some time to fix the API.

zanna-37 commented 1 year ago

Don't worry, I used the --quality flag after noticing the problem, so I'm good. I just wanted to let you know because it can be hard to spot for a new user. Thanks again for your time and the amazing repo!

beaufour commented 1 year ago

I'm very happy you reported this. Thank you! And I'm happy the repo has helped you. I fixed the underlying lib just now, but I need to test a bit more and then release both the lib and this repo

https://github.com/alexis-mignon/python-flickr-api/commit/cbfbd5b584a7ab864ae760700297df60b51f7afe

beaufour commented 1 year ago

Thanks for the suggestion here, it is now both released in the API and this tool

https://github.com/beaufour/flickr-download/releases/tag/v0.3.4