All Projects → JosePineiro → Webp Wrapper

JosePineiro / Webp Wrapper

Licence: mit
Wrapper for libwebp in C#. The most complete wapper in pure managed C#. Exposes Simple Decoding API, Simple Encoding API, Advanced Encoding API (with stadistis of compresion), Get version library and WebPGetFeatures (info of any WebP file). In the future I´ll update for expose Advanced Decoding API. The wapper are in safe managed code in one class. No need external dll except libwebp.dll (included). The wapper work in 32 and 64 bit system.

Labels

Projects that are alternatives of or similar to Webp Wrapper

Webpquicklook
Mac OS X QuickLook plugin for WebP image files
Stars: ✭ 655 (+512.15%)
Mutual labels:  webp
Isparta
APNG、WebP converter
Stars: ✭ 942 (+780.37%)
Mutual labels:  webp
Optimise Images
Batch image resizer, optimiser and profiler using ImageMagick convert, OptiPNG, JpegOptim and optional ZopfliPNG, Guetzli and MozJPEG.
Stars: ✭ 64 (-40.19%)
Mutual labels:  webp
Vanilla Lazyload
LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
Stars: ✭ 6,596 (+6064.49%)
Mutual labels:  webp
Is Animated
Checks if image is animated 🎞
Stars: ✭ 17 (-84.11%)
Mutual labels:  webp
Qlimagesize
QuickLook and Spotlight plugins to display the dimensions, size and DPI of an image in the title bar instead of the filename. Also preview some unsupported formats like WebP & bpg.
Stars: ✭ 1,071 (+900.93%)
Mutual labels:  webp
Optimizt
CLI image optimization tool
Stars: ✭ 594 (+455.14%)
Mutual labels:  webp
Sdwebimagewebpcoder
A WebP coder plugin for SDWebImage, use libwebp
Stars: ✭ 101 (-5.61%)
Mutual labels:  webp
Sdwebimageswiftui
SwiftUI Image loading and Animation framework powered by SDWebImage
Stars: ✭ 844 (+688.79%)
Mutual labels:  webp
Tiny Site
图片优化
Stars: ✭ 65 (-39.25%)
Mutual labels:  webp
Flyimg
Dockerized PHP7 application runs as a Microservice to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).
Stars: ✭ 762 (+612.15%)
Mutual labels:  webp
Webp Support
Simple script to check browser support of webp images format.
Stars: ✭ 5 (-95.33%)
Mutual labels:  webp
Responsively Lazy
Lazy load responsive images
Stars: ✭ 1,080 (+909.35%)
Mutual labels:  webp
Nuxt Optimized Images
🌅🚀 Automatically optimizes images used in Nuxt.js projects (JPEG, PNG, SVG, WebP and GIF).
Stars: ✭ 717 (+570.09%)
Mutual labels:  webp
Lqip Modern
Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp.
Stars: ✭ 85 (-20.56%)
Mutual labels:  webp
Libvips
A fast image processing library with low memory needs.
Stars: ✭ 6,094 (+5595.33%)
Mutual labels:  webp
Pywebp
Python bindings for WebP
Stars: ✭ 35 (-67.29%)
Mutual labels:  webp
Bimg
Go package for fast high-level image processing powered by libvips C library
Stars: ✭ 1,394 (+1202.8%)
Mutual labels:  webp
React Native Webp Format
WebP image integration for React Native apps.
Stars: ✭ 99 (-7.48%)
Mutual labels:  webp
Unity.webp
🎨 WebP made easy for Unity3d
Stars: ✭ 59 (-44.86%)
Mutual labels:  webp

WebP-wrapper

Wrapper for libwebp in C#. The most complete wrapper in pure managed C#.

Exposes Simple Decoding API and Encoding API, Advanced Decoding and Encoding API (with stadistis of compresion), Get version library and WebPGetFeatures (info of any WebP file). Exposed get PSNR, SSIM or LSIM distortion metrics.

The wrapper is in safe managed code in one class. No need external dll except libwebp_x86.dll(included v0.4.4) and libwebp_x64.dll (included v1.0.3). The wrapper work in 32, 64 bit or ANY (auto swith to the apropiate library).

The code is comented and include simple example for using the wrapper.

Decompress Functions:

Load WebP image for WebP file

using (WebP webp = new WebP())
  Bitmap bmp = webp.Load("test.webp");

Decode WebP filename to bitmap and load in PictureBox container

byte[] rawWebP = File.ReadAllBytes("test.webp");
using (WebP webp = new WebP())
  this.pictureBox.Image = webp.Decode(rawWebP);

Advanced decode WebP filename to bitmap and load in PictureBox container

byte[] rawWebP = File.ReadAllBytes("test.webp");
WebPDecoderOptions decoderOptions = new WebPDecoderOptions();
decoderOptions.use_threads = 1;     //Use multhreading
decoderOptions.flip = 1;   			//Flip the image
using (WebP webp = new WebP())
  this.pictureBox.Image = webp.Decode(rawWebP, decoderOptions);

Get thumbnail with 200x150 pixels in fast/low quality mode

using (WebP webp = new WebP())
	this.pictureBox.Image = webp.GetThumbnailFast(rawWebP, 200, 150);

Get thumbnail with 200x150 pixels in slow/high quality mode

using (WebP webp = new WebP())
	this.pictureBox.Image = webp.GetThumbnailQuality(rawWebP, 200, 150);

Compress Functions:

Save bitmap to WebP file

Bitmap bmp = new Bitmap("test.jpg");
using (WebP webp = new WebP())
  webp.Save(bmp, 80, "test.webp");

Encode to memory buffer in lossly mode with quality 75 and save to file

byte[] rawWebP = File.ReadAllBytes("test.jpg");
using (WebP webp = new WebP())
  rawWebP = webp.EncodeLossy(bmp, 75);
File.WriteAllBytes("test.webp", rawWebP); 

Encode to memory buffer in lossly mode with quality 75 and speed 9. Save to file

byte[] rawWebP = File.ReadAllBytes("test.jpg");
using (WebP webp = new WebP())
  rawWebP = webp.EncodeLossy(bmp, 75, 9);
File.WriteAllBytes("test.webp", rawWebP); 

Encode to memory buffer in lossly mode with quality 75, speed 9 and get information. Save to file

byte[] rawWebP = File.ReadAllBytes("test.jpg");
using (WebP webp = new WebP())
  rawWebP = webp.EncodeLossy(bmp, 75, 9, true);
File.WriteAllBytes("test.webp", rawWebP); 

Encode to memory buffer in lossless mode and save to file

byte[] rawWebP = File.ReadAllBytes("test.jpg");
using (WebP webp = new WebP())
  rawWebP = webp.EncodeLossless(bmp);
File.WriteAllBytes("test.webp", rawWebP); 

Encode to memory buffer in lossless mode with speed 9 and save to file

byte[] rawWebP = File.ReadAllBytes("test.jpg");
using (WebP webp = new WebP())
  rawWebP = webp.EncodeLossless(bmp, 9);
File.WriteAllBytes("test.webp", rawWebP); 

Encode to memory buffer in near lossless mode with quality 40 and speed 9 and save to file

byte[] rawWebP = File.ReadAllBytes("test.jpg");
using (WebP webp = new WebP())
  rawWebP = webp.EncodeNearLossless(bmp, 40, 9);
File.WriteAllBytes("test.webp", rawWebP); 

Another Functions:

Get version of libwebp.dll

using (WebP webp = new WebP())
  string version = "libwebp.dll v" + webp.GetVersion();

Get info from WebP file

byte[] rawWebp = File.ReadAllBytes(pathFileName);
using (WebP webp = new WebP())
  webp.GetInfo(rawWebp, out width, out height, out has_alpha, out has_animation, out format);
MessageBox.Show("Width: " + width + "\n" +
                "Height: " + height + "\n" +
                "Has alpha: " + has_alpha + "\n" +
                "Is animation: " + has_animation + "\n" +
                "Format: " + format);

Get PSNR, SSIM or LSIM distortion metric between two pictures

int metric = 0;  //0 = PSNR, 1= SSIM, 2=LSIM
Bitmap bmp1 = Bitmap.FromFile("image1.png");
Bitmap bmp2 = Bitmap.FromFile("image2.png");
using (WebP webp = new WebP())
	result = webp.GetPictureDistortion(source, reference, metric);
	                    MessageBox.Show("Red: " + result[0] + "dB.\nGreen: " + result[1] + "dB.\nBlue: " + result[2] + "dB.\nAlpha: " + result[3] + "dB.\nAll: " + result[4] + "dB.", "PSNR");

MessageBox.Show("Red: " + result[0] + dB\n" +
                "Green: " + result[1] + "dB\n" +
                "Blue: " + result[2] + "dB\n" +
                "Alpha: " + result[3] + "dB\n" +
                "All: " + result[4] + "dB\n");

Thanks to [email protected]

Without their help this wapper would not have been possible.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].