Otiel / BandcampDownloader

A Windows app used to download albums from Bandcamp.
Other
941 stars 76 forks source link

Rename cover art filename to png if wrongly named by Bandcamp #168

Open celynw opened 3 years ago

celynw commented 3 years ago

I've noticed something strange when downloading the cover art.

I have set the following options to try and get a single, maximum quality file (hopefully PNG).

🗹 Save in folder     ☐ Convert to JPG     ☐ Constrain maximum width/height

I still always end up with a cover.jpg. When I go to look at what the maximum quality should be, bandcamp presents me with a address ending in .jpg, but apparently this is actually a PNG image. And it seems the file downloaded by BandcampDownloader is also a PNG disguised as a JPG. URLs for both file extensions work, but diff says they are identical (makes sense).

Original `.jpg` ![1 Screenshot 2020-11-06 153743](https://user-images.githubusercontent.com/3299161/98387216-0a279600-2049-11eb-85d5-87d0cf813283.png)
`.png` version ![2 Screenshot 2020-11-06 154234](https://user-images.githubusercontent.com/3299161/98387417-43f89c80-2049-11eb-8b59-2b683ae26155.png)
Output of BandcampDownloader ![3 Screenshot 2020-11-06 153915](https://user-images.githubusercontent.com/3299161/98387437-4824ba00-2049-11eb-9915-d3115d759004.png)

For a different album, (one used in #64) it really is a JPG, even if you ask for the PNG.

Original `.jpg` ![4 Screenshot 2020-11-06 154352](https://user-images.githubusercontent.com/3299161/98387456-4eb33180-2049-11eb-9bda-855bdb1b30a2.png)
`.png` version ![5 Screenshot 2020-11-06 154404](https://user-images.githubusercontent.com/3299161/98387463-51ae2200-2049-11eb-96b2-071a5b3a7afb.png)
Output of BandcampDownloader ![6 Screenshot 2020-11-06 154507](https://user-images.githubusercontent.com/3299161/98387471-54a91280-2049-11eb-8480-5c732636b2ca.png)

I guess the short question, is if the downloaded files could have the correct extension?

Otiel commented 3 years ago

Good catch! Not sure why Bandcamp renames PNG images to .jpg.

I'll have to see if I can rely on the Content-Type header to rename the file accordingly.

DarkVoyage commented 1 year ago

It is not Bandcamp, but Bandcamp Downloader uses jpg extension to save. If you request any image without extension (i.e. https://f4.bcbits.com/img/a2498578482_0) - you will get the correct format, at least this works in browser.

Also to topic starter - original is original, you can't request png or jpg, it will always be what is uploaded by author.