regosen / get_cover_art

Batch cover art downloader and embedder for audio files
MIT License
69 stars 8 forks source link

Question about image quality #24

Closed audiomuze closed 2 years ago

audiomuze commented 2 years ago

I just downloaded Apple Music's image for https://music.apple.com/us/album/brighter-eyes-ep/1565783103 using right click, open image in new window and replacing the filename with the URL yielded by https://atisket.pulsewidth.org.uk/, which in this instance is:

https://is3-ssl.mzstatic.com/image/thumb/Music125/v4/1c/7a/bb/1c7abbc6-5e36-91d5-3638-9b575da559e5/195269089238_cover.jpg/9999x9999-100.jpg. That file is ~1.4M in size.

The file retrieved by get_cover_art is:

https://is2-ssl.mzstatic.com/image/thumb/Music125/v4/1c/7a/bb/1c7abbc6-5e36-91d5-3638-9b575da559e5/195269089238_cover.jpg/9999x9999.jpg, which is ~427k

Comparing the URLs, (and ignoring the server name which is irrelevant for this report) the URLs are identical except for the better quality image having -100 appended to the end of the filename, before the file extension: https://is3-ssl.mzstatic.com/image/thumb/Music125/v4/1c/7a/bb/1c7abbc6-5e36-91d5-3638-9b575da559e5/195269089238_cover.jpg/9999x9999-100.jpg

I've tested same manually using a browser and get identical results. Could you pleaase amend the code called when --art-size 9999 is invoked to append -100 to the filename such that it takes the form 9999x9999-100.jpg for download.

regosen commented 2 years ago

Oh interesting, when I right-click the cover art I get a file ending in "500x500bb" not "9999x9999-100", what do the suffixes mean? Is it because I'm in the US?

Also I'm surprised about get_cover_art using a URL that ends with "9999x9999.jpg" instead of "9999x9999bb.jpg", the "bb" is hard-coded in the script.

I actually have no idea what "bb" or "-100" does, but I did notice that either suffix works (and even without the suffix), and this isn't even specific to 9999x9999. Do you know what these suffixes mean?

audiomuze commented 2 years ago

Apologies, I'm clearly not communicating effectively. If I right click on the image in the album page and open image in new tab it opens to:

https://is2-ssl.mzstatic.com/image/thumb/Music125/v4/1c/7a/bb/1c7abbc6-5e36-91d5-3638-9b575da559e5/195269089238_cover.jpg/1000x1000bb.webp

If I then replace "1000" with "9999" and "webp" to "jpg", changing the URL to:

https://is2-ssl.mzstatic.com/image/thumb/Music125/v4/1c/7a/bb/1c7abbc6-5e36-91d5-3638-9b575da559e5/195269089238_cover.jpg/9999x9999bb.jpg

it yields the 427kb JPG that get_cover_art is downloading.

To get the full-fat high-resolution image the "bb" should be replaced with "-100", changing the URL to: https://is2-ssl.mzstatic.com/image/thumb/Music125/v4/1c/7a/bb/1c7abbc6-5e36-91d5-3638-9b575da559e5/195269089238_cover.jpg/9999x9999-100.jpg

which is the ~1.4MB file I referenced.

So the ask is to change the code to drop the "bb" suffix and replace it with "-100" so that the highest resolution image is yielded and downloaded.

I'm not entirely sure what the suffixes mean, but my guess is that the "-100" suffix causes Apple Music to yield the original uncompressed image.

regosen commented 2 years ago

Now you should be able to update to 1.5.9 and run with --art-quality 100, let me know if it doesn't work for you

audiomuze commented 2 years ago

Thanks, I'll pull and check.

audiomuze commented 2 years ago

This seems to be working as intended. Thanks!