Skip to content

Commit

Permalink
Added test for lossless WebP images
Browse files Browse the repository at this point in the history
  • Loading branch information
amandeepg committed Sep 14, 2012
1 parent c58ffd7 commit 35fcf3f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions feature-detects/img-webp-lossless.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// code.google.com/speed/webp/
// tests for lossless webp support, as detailed in https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification
// by @amandeep - based off of the img-webp-test

// This test is asynchronous. Watch out.

(function(){

var image = new Image();

image.onerror = function() {
Modernizr.addTest('webp-lossless', false);
};
image.onload = function() {
Modernizr.addTest('webp-lossless', function() { return image.width == 1; });
};

image.src = 'data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==';

}());

0 comments on commit 35fcf3f

Please sign in to comment.