Monday, May 7, 2012

Converting multiple files into WebP under Windows (MultiWebP)

You know of Google's image format WebP? If you do and you want to convert your images to .webp, you'll notice it's a bit hard, as you have to do it image by image. I wrote a little batch file, called MultiWebP, which can automate this for you ;) You can download it bellow. There are two files - test.bat and encode.bat. The first is optional and is used to encode only one file, just to test the settings. The second file is used to encode the whole folder :)

Update: New version is out!
Details for MultiWebP 2.0:
- Only one file! test.bat and encode.bat are now combined in MultiWebP.bat.
- One file means only one line of settings, not two as before.
- Subfolders. MultiWebP now supports subfolders. You can run it on a parent folder and all files will be encoded, even those in subfolders.
- Progress. MultiWebP now shows total files to convert and files converted till now.
- Colors. MultiWebP now shows it's window in different colors, depending on the progress made. This is useful for remote observing (if you lay down on your bed and wait it to finish). Color levels: black - 0 to 32%, blue - 33 to 66%, aqua 67 to 100% and green when all is done.
- Beep. Additionally Windows' beep sound is heard upon all task completed.

Installation:
1. Download WebP package from Google and extract it somewhere. Optional you can download WebP codec to be able to open .webp files with your Windows Photo Viewer.
2. Download my scripts and extract them.
3. Place the two files next to cwebp.exe.

4. Create two shortcuts for test.bat and encode.bat and name them as you like.

5. Open Explorer and type in the address bar %APPDATA%\Microsoft\Windows\SendTo
6. Paste the two shortcuts there. Now you should see both of them in the Send To menu.

Settings:
You should read Readme.txt of WebP and learn about what cwebp.exe parameters are available. Then you should open test.bat/encode.bat, find cwebp.exe and change it's parameters. I've included some by default, so you can start using my scripts without changing settings.

Usage:
1. Create a folder where you'll put cwebp.exe supported images that have common source (shot with the same camera), to ensure settings will be the same for all files.
2. Right click one of the files and send it to test.bat.

3. Change settings for test.bat if you don't like the result and repeat step 2, until you are pleased with the result.
4. After you found your settings, copy them to encode.bat.
6. You are about to convert the whole folder, so make sure you don't have any unsupported by cwebp.exe files as they will be deleted in the end!
7. Right click on the folder and send it to encode.bat.

8. Go take a walk :)

6 comments :

  1. Hey Цветелин, thank you very much for this program. I wrote a little review on MobilityDigest, let me know if you ever change the URL and I'll amend the article.

    Here -- mobilitydigest.com/windows-protip-batch-convert-jpegs-to-webp-using-multiwebp

    Doug

    ReplyDelete
  2. Thanks, that's very thoughtful of you. By the way, my nickname is metal03326 - maybe it'll be easier for your reader than Цветелин Новкиришки ;)

    ReplyDelete
  3. Excellent, thanks a lot for this! Very useful.

    (I just tested with the most recent download from Google and it still works, just in case any one was wondering as this article was written in 2012).

    ReplyDelete
  4. Can I add a feature request? It would be awesome if you could specify a different output directory - whilst keeping the same directory structure!

    ReplyDelete
    Replies
    1. I've found an alternative solution:
      http://superuser.com/questions/112537/windows-7-move-only-files-of-a-given-extension-while-preserving-folder-structu

      I can just robocopy them into place afterwards

      Delete
  5. I think one thing to be weary of with this script.
    If there's the possability of another process copying in extra jpegs into the folder where multiwebp is working.... I believe multiwebp could end up deleting the jpeg not realising that a webp file has not been created.

    ReplyDelete