Author Topic: Batch converting .webp cover art to .jpg for use in MusicBee  (Read 4485 times)

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
MusicBee like some other players will not read album art in the .webp format, found increasingly on the web and notably in the excellent last.fm photo collections.  Here is a batch file that will allow you to select one or more image files in the webp (or others!) format and convert them to jpg from the right-click Windows context "Send to" menu, before adding to your music files via MusicBee's tag editor.  The original file is kept, the converted one will have the same name with the *.jpg extension.

This method depends on having the freeware image viewer/editor IrfanView installed.  The WEBP developers have their own command line tool but it will not convert to jpg, hence the workaround.  Copy the bat file below into a text file like "BatchConvert to JPG", changing the path of Irfanview to match yours and "i_view32.exe" to "i_view64.exe" if you have the 64-bit version.  Then, save the result as a *.bat file in the Windows "SendTo" folder.  The latter is normally at C:\Users\(username)\AppData\Roaming\Microsoft\Windows\SendTo.

Then, you can select one or more webp files (using ctrl-click, etc), right-click and choose "Send to-->BatchConvert to JPG.bat", which will bypass the IrfanView GUI and quickly convert the files into *.jpg, keeping the originals.

Code
@echo off

echo The file(s) will be converted to JPG


:START  

if "%~f1"=="" (

   echo No more args given. Done.

   exit /b 0

)


:WORK
  
   C:\Windows\System32\cmd.exe /c "%ProgramFiles%\IrfanView\i_view32.exe" %1 /convert=%~n1.jpg


:NEXTARG

   shift

   goto START

Zak

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 2450
The WEBP developers have their own command line tool but it will not convert to jpg, hence the workaround.

That's true, but dwebp will convert to .png, which MusicBee will read.
This might be easier for people who don't want to install Irfanview just for converting images.

https://developers.google.com/speed/webp/docs/using
Bee excellent to each other...

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
Yes it's certainly an option.  For those who would like to convert WEBP to PNG without using IrfanView, you can grab the latest 64-bit build of dwebp.exe inside the "bin" subdirectory of the zip here:

https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0-windows-x64.zip .

The latest 32-bit build is here: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.3-windows-x86.zip .

To use the *.bat file above with dwebp, the easiest thing to do is drop only the file "dwebp.exe" into your Windows directory (which puts it in a standard environmental variables path) and change the line between WORK: and NEXTARG: to just

dwebp %1 -o %~n1.png

Newcomers to the format should be aware that .webp files converted to .png will have large file sizes compared to a conversion to .jpg.  For example, a sample webp with a file size of 61.5 kb converted with dwebp to a png of 760 kb (vs. 117 kb jpg).  There is no obvious way to adjust the png compression ratio in dwebp's available options.
Last Edit: March 03, 2020, 07:18:36 PM by sveakul