Skip to content

Commit

Permalink
Image metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
SlexAxton committed Jun 2, 2013
1 parent 34807de commit de1238d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 13 deletions.
23 changes: 19 additions & 4 deletions feature-detects/img/apng.js
@@ -1,7 +1,21 @@
define(['Modernizr', 'createElement', 'addTest', 'test/canvas'], function( Modernizr, createElement, addTest ) {
// Animated PNG
// http://en.wikipedia.org/wiki/APNG
/*!
{
"name": "Animated PNG",
"async": true,
"property": "apng",
"tags": ["image"],
"notes": [{
"name": "Wikipedia Article",
"href": "http://en.wikipedia.org/wiki/APNG"
}]
}
!*/
/* DOC
Test for animated png support.
*/
define(['Modernizr', 'createElement', 'addTest', 'test/canvas'], function( Modernizr, createElement, addTest ) {
Modernizr.addAsyncTest(function () {
if (!Modernizr.canvas) {
return false;
Expand All @@ -15,7 +29,8 @@ define(['Modernizr', 'createElement', 'addTest', 'test/canvas'], function( Moder
addTest('apng', function () {
if (typeof canvas.getContext == 'undefined') {
return false;
} else {
}
else {
ctx.drawImage(image, 0, 0);
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
}
Expand Down
25 changes: 20 additions & 5 deletions feature-detects/img/webp-lossless.js
@@ -1,10 +1,25 @@
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
// 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
/*!
{
"name": "Webp Lossless",
"async": true,
"property": ["webplossless", "webp-lossless"],
"tags": ["image"],
"authors": ["@amandeep", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "Webp Info",
"href": "http://code.google.com/speed/webp/"
},{
"name": "Webp Lossless Spec",
"href": "https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification"
}]
}
!*/
/* DOC
// This test is asynchronous. Watch out.
Tests for lossless webp support.
*/
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
Modernizr.addAsyncTest(function(){
var image = new Image();

Expand Down
21 changes: 17 additions & 4 deletions feature-detects/img/webp.js
@@ -1,9 +1,22 @@
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
// code.google.com/speed/webp/
// by rich bradshaw, ryan seddon, and paul irish
/*!
{
"name": "Webp",
"async": true,
"property": "webp",
"tags": ["image"],
"authors": ["Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "Webp Info",
"href": "http://code.google.com/speed/webp/"
}]
}
!*/
/* DOC
// This test is asynchronous. Watch out.
Tests for webp support.
*/
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
Modernizr.addAsyncTest(function(){
var image = new Image();

Expand Down

0 comments on commit de1238d

Please sign in to comment.