You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
The program loads an image (in any of the widely supported formats such as JPEG,PNG or BMP) and encodes it in the WebP lossless format (VP8L codec). The programuses most of the features of the VP8L format to achieve better compression thanPNG and is not much worse than the officiallibwebp implementation. However,the program is quite slow compared to the heavily optimized image compressionlibraries currently in use, but this is mostly due to the focus on clarityrather than on performance.
The implemented VP8L features include:
entropy coding of image data using canonical Huffman codes
LZ77 backward references
local color cache references (currently disabled, as it does not improvecompression)
palettization, possibly using sub-byte packing
subtract-green color transform to crudely decorrelate color channels
spatially-varying prediction
The notable features that arenot implemented are:
spatially-varying Huffman codes
advanced cross-color transform
The encoded images are usually 65%--90% size of PNG and 110%--160% the size oflossless WebP images produced bylibwebp.
Usage
Compile all the C# files in theVP8L/ directory and add a reference toSystem.Drawing to get an executableVP8L.exe. AMakefile is attached thatinvokesmcs that will do the trick. The executable can be invoked with twocommand-line arguments, as
VP8L.exe [input] [output]
where[input] is the path to the input image and[output] is the name of theproduced.webp file. The default paths areinput.png andoutput.webp.
Test images
The distribution includes a small corpus of images intest/input, used to testthe program. The included scripttest.sh invokes the program and stores thegenerated images intest/output. It also converts the images into WebP usingcwebp, the tool shipped withlibwebp, and saves them totest/ref forcomparison. To check that the output images are valid, the script converts themback to PNG usingdwebp, which also serves as a check that the produced WebPimages are valid.
Note that the script expects to find thedwebp andcwebp binaries in thetest/ directory and executes the program usingmono VP8L.exe.
Source guide
TheMain is located inVP8L/VP8L.cs, other source files are mostly namedafter the mainclass they contain (Argb.cs,Image.cs, ...) or thestatic class that must be used to wrap functions (Transform.cs,ImageData.cs,...). Read the comments to gain basic understanding of the inner workings.