All Projects â†’ chase-moskal â†’ Webp Hero

chase-moskal / Webp Hero

Licence: isc
browser polyfill for the webp image format

Projects that are alternatives of or similar to Webp Hero

Hunter
No description, website, or topics provided.
Stars: ✭ 1,882 (+1000.58%)
Mutual labels:  cmake
Sparkle
🎇 A modern particle engine running on GPU, using c++14 and OpenGL 4.4.
Stars: ✭ 162 (-5.26%)
Mutual labels:  cmake
Dav1d
A read-only mirror of dav1d source code repository. The origin is at https://code.videolan.org/videolan/dav1d/
Stars: ✭ 168 (-1.75%)
Mutual labels:  decoder
Faup
Fast URL decoder library
Stars: ✭ 159 (-7.02%)
Mutual labels:  cmake
Cmake Tutorial
CMake 厘斚教į¨‹
Stars: ✭ 162 (-5.26%)
Mutual labels:  cmake
Cdt
C++ library for constrained Delaunay triangulation (CDT)
Stars: ✭ 165 (-3.51%)
Mutual labels:  cmake
Mini Cmake Qt
A minimal CMake template for Qt 5 & 6 projects
Stars: ✭ 156 (-8.77%)
Mutual labels:  cmake
Caffe Builder
CMake build scripts to automate building the Caffe library and its dependencies.
Stars: ✭ 170 (-0.58%)
Mutual labels:  cmake
Glitter
Dead Simple OpenGL
Stars: ✭ 2,040 (+1092.98%)
Mutual labels:  cmake
Div Games Studio
Complete cross platform games development package, originally for DOS but now available on modern platforms.
Stars: ✭ 168 (-1.75%)
Mutual labels:  cmake
Ctc pytorch
CTC end -to-end ASR for timit and 863 corpus.
Stars: ✭ 161 (-5.85%)
Mutual labels:  decoder
Raz
Modern & multiplatform game engine in C++17
Stars: ✭ 161 (-5.85%)
Mutual labels:  cmake
Gojay
fastest JSON encoder/decoder with powerful stream API for Golang
Stars: ✭ 2,009 (+1074.85%)
Mutual labels:  decoder
Ecosystem
A cross-platform environment management system for VFX/animation production plus R&D
Stars: ✭ 159 (-7.02%)
Mutual labels:  cmake
Iphone Inline Video
📱 Make videos playable inline on the iPhone (prevents automatic fullscreen)
Stars: ✭ 2,020 (+1081.29%)
Mutual labels:  polyfill
Ffmediatoolkit
FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
Stars: ✭ 156 (-8.77%)
Mutual labels:  decoder
Primitiv
A Neural Network Toolkit.
Stars: ✭ 164 (-4.09%)
Mutual labels:  cmake
Vcpkg
C++ Library Manager for Windows, Linux, and MacOS
Stars: ✭ 14,449 (+8349.71%)
Mutual labels:  cmake
Imagepipeline
Folio Image Pipeline is an image loading and caching framework for iOS clients
Stars: ✭ 170 (-0.58%)
Mutual labels:  webp
Oysterkit
OysterKit is a framework that provides a native Swift scanning, lexical analysis, and parsing capabilities. In addition it provides a language that can be used to rapidly define the rules used by OysterKit called STLR
Stars: ✭ 167 (-2.34%)
Mutual labels:  decoder

đŸĻ¸â€â™‚ī¸ webp-hero

browser polyfill for the webp image format

  • 🎉 webp images come alive, even in safari and ie11! (firefox and edge now support webp)
  • ⚙ī¸ webp-hero actually runs google's libwebp decoder in the browser (converts webp images to png on-the-fly)
  • 🕹ī¸ live demo
    • webp-hero/ — webp-hero polyfill operating normally (does nothing if your browser supports webp)
    • webp-hero/?force — webp conversion to png is forced (even if your browser supports webp)
  • â™ģī¸ freshness
  • đŸ’¯ browser support tested 2020-08-26
    • evergreen browsers (chrome, firefox, edge, desktop safari)
    • windows 7 ie11
    • iphone 7 mobile safari
    • galaxy s5 samsung internet
  • ⚠ī¸ known issues and deficiencies
    • doesn't yet support css background images (pull requests welcome!)
    • doesn't yet support <picture> elements
    • doesn't yet support web workers (decodes images one-at-a-time, blocking, single-threaded)
    • currently only detects webp images with filename ending in .webp extension
    • no wasm (because older browsers)
    • at one megabyte, the decoder is quite heavy

webp-hero installation and usage

  • option A — html install, use webp-hero's bundle with the polyfills
    you just inject the html onto your page. this technique works nicely for older browsers like ie11

    1. load generic polyfills and the webp-hero global bundle via script tags

      <script src="https://unpkg.com/[email protected]/dist-cjs/polyfills.js"></script>
      <script src="https://unpkg.com/[email protected]/dist-cjs/webp-hero.bundle.js"></script>
      
    2. run the webp-hero polyfill function on the document

      <script>
      	var webpMachine = new webpHero.WebpMachine()
      	webpMachine.polyfillDocument()
      </script>
      
  • option B — commonjs install, use webp-hero's cjs modules in your application
    you'll be familiar with this if you're bundling a commonjs with browserify or webpack

    1. install the webp-hero npm package

      npm install webp-hero

    2. import and run the webp-hero polyfill function

      import {WebpMachine} from "webp-hero"
      const webpMachine = new WebpMachine()
      webpMachine.polyfillDocument()
      
    3. if you want to support old browsers like ie11,
      you might want to include your own polyfills or import webp-hero/dist-cjs/polyfills.js

  • option C — es-module install, like in the future
    es modules are available. but why would anybody use these for webp-hero? i guess it could be useful for.. mobile safari? anyways, this won't work in older browsers, which might defeat the purpose of using webp-hero in the first place? well.. it's here for you if you need it!

    1. use webp-hero on your page in one script tag

      <script type="module">
      	import {WebpMachine} from "https://unpkg.com/[email protected]/dist/webp-machine.js"
      	const webpMachine = new WebpMachine()
      	webpMachine.polyfillDocument()
      </script>
      
  • option D — angular users should look at ngx-webp-polyfill

webp-hero advanced usage

webp-machine

  • webp-machine.ts has logic for polyfilling, caching, and enforcing sequential webp decoding
    • new WebpMachine({...options}) — all options have defaults, but you can override them
      • {webp} google module which contains the actual decoder
      • {webpSupport} function which detects whether the browser supports webp
      • {detectWebpImage} detect whether or not the provided <img> element is in webp format
    • the webpMachine you create has the following methods
      • webpMachine.polyfillDocument() — run over the entire html document, sniffing out webp <img> elements to convert (only if the browser doesn't support webp)
      • webpMachine.polyfillImage(imageElement) — converts the given webp image (only if the browser doesn't support webp)
      • webpMachine.decode(webpData) — decode webp Uint8Array data, return a png data-url
      • webpMachine.clearCache() — manually wipe the cache to save memory
  • other modules like convert-binary-data.ts and etc may be unstable, you might not want to rely on those

manual-style with the google libwebp decoder

  • we compile from google's libwebp emscripten build in a docker container
  • this build contains minimal functionality for rendering webp data to a canvas:
    • google's emscripten output: webp-hero/libwebp/google/webp.js
  • we do little hacks to wrap this build into two modules:
    • common-js: webp-hero/libwebp/webp.cjs.js
    • es-module: webp-hero/libwebp/webp.js
  • we have a typescript declaration for it too: webp.d.ts

webp-hero dev and contributing

  • prerequisites

    • git and node
    • docker (only if you want to rebuild google's libwebp)
  • webp-hero development

    • npm install — install dependencies and run build
      • runs a typescript build, uses browserify to make the bundle
      • generates webp-hero/dist/ and webp-hero/dist-cjs/
      • generates the polyfills (cjs-only)
      • does not rebuild google's libwebp
    • npm start — start http server
  • rebuild google's libwebp

    • libwebp build artifacts in libwebp/dist are checked into git, because it takes so damn long to build
    • libwebp/build — run dockerized libwebp build, regenerates libwebp/dist
    • libwebp/debug — handy for debugging the dockerized build
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].