Sunday, September 20, 2015

Convert PNG, JPEG, TIFF to WebP

Standard
Hello All:

Everybody wants to reduce the size of his/her android application. Images contribute a lot in increasing the application size. Google has released a new image type Webp. In this post I will share a simple utility which can do bulk conversion of images to webp.
Android support webp by default from Android 4.0 (Source)

I have created a simple windows utility which uses Google's cwebp encoder.



This utility provides following features
  1. Convert a file or all files in a folder
  2. Backup the old files
  3. By default, the utility deletes the file whose webp file size is less than the original file.
    1. "Delete Original" will override this
  4. Options to select file filters
  5. Compression quality 

The code for this can be found here.

Hope this helps. Happy coding.




Thanks for printing this post. Hope you liked it.
Keep visiting and sharing.
Thanks,
Ashwani.

1 comment :

  1. May I ask for suggestions?
    If so, here:
    1. There are cases that WebP is actually larger than the original file. It would be better to let the original file stay in case conversion didn't help
    2. It would be great to be able to set the output folder and also do the process in the background with progress bar
    3. Allow to choose multiple folders (and optionally get the output folder in another place)
    4. Show stats : before the conversion and after. This might include stats for sizes (in bytes), decoding and encoding times
    5. Multi-platform (maybe use java), so that Linux and MacOs can also use this tool.
    6. For cases that png files don't really have pixels with alpha, try to also convert to jpg, and then check which is better: jpg or webP .

    ReplyDelete