visual-c++directxgdi+webpvp8

Distorted images from libWebP encoder


I had been using GDI+ & CxImage libraries for saving my images captured from the desktop and thought of moving to google's LibWebp as it is promising good quality images with better compression than JPEG or PNG.

I capture the desktop either using using directX or GDI on windows, encode and save them or transfer over the network and decode them on the other side. Every thing looks good except that the images captured with text are distorted but the same is not happening for web pages with heavy text content.

The texts are encoded properly whenever the background color changes(either being selected or highlighted). I do not understand what the problem is.

Here is a sample of an image of command prompt I encoded using libWebp, you can clearly see that the selected area is encoded properly and the rest are randomly distorted.

enter image description here

enter image description here

I do not find any resources or forums that discuss these kind of strange problems. Any help would be appreciated.

Thanks in advance.


Solution

  • The problem was with using the WebPPictureImportRGBA to import RGBA buffer, given 32bit RGBA as input, using WebPPictureImportRGBX solved the problem.