define(['mac/palette16'], function(palette) {

  'use strict';

  return function(item) {
    return item.getBytes().then(function(bytes) {
      if (bytes.length !== 512) {
        return Promise.reject('icl4 resource expected to be 512 bytes, got ' + bytes.length);
      }
      item.withPixels(32, 32, function(pixelData) {
        for (var ibyte = 0; ibyte < 512; ibyte++) {
          pixelData.set(palette[bytes[ibyte] >> 4], ibyte*8);
          pixelData.set(palette[bytes[ibyte] & 15], ibyte*8 + 4);
        }
      });
    });
  };

});

define(['mac/palette16'], function(palette) {

  'use strict';

  return function(resource) {
    if (resource.data.length !== 512) {
      console.error('icl4 resource expected to be 512 bytes, got ' + resource.data.length);
      return;
    }
    var img = document.createElement('CANVAS');
    img.width = 32;
    img.height = 32;
    var ctx = img.getContext('2d');
    var pix = ctx.createImageData(32, 32);
    for (var ibyte = 0; ibyte < 512; ibyte++) {
      pix.data.set(palette[resource.data[ibyte] >> 4], ibyte*8);
      pix.data.set(palette[resource.data[ibyte] & 15], ibyte*8 + 4);
    }
    ctx.putImageData(pix, 0, 0);
    resource.image = {url: img.toDataURL(), width:32, height:32};
  };

});

--- 
+++ 
@@ -2,22 +2,18 @@
 
   'use strict';
 
-  return function(resource) {
-    if (resource.data.length !== 512) {
-      console.error('icl4 resource expected to be 512 bytes, got ' + resource.data.length);
-      return;
-    }
-    var img = document.createElement('CANVAS');
-    img.width = 32;
-    img.height = 32;
-    var ctx = img.getContext('2d');
-    var pix = ctx.createImageData(32, 32);
-    for (var ibyte = 0; ibyte < 512; ibyte++) {
-      pix.data.set(palette[resource.data[ibyte] >> 4], ibyte*8);
-      pix.data.set(palette[resource.data[ibyte] & 15], ibyte*8 + 4);
-    }
-    ctx.putImageData(pix, 0, 0);
-    resource.image = {url: img.toDataURL(), width:32, height:32};
+  return function(item) {
+    return item.getBytes().then(function(bytes) {
+      if (bytes.length !== 512) {
+        return Promise.reject('icl4 resource expected to be 512 bytes, got ' + bytes.length);
+      }
+      item.withPixels(32, 32, function(pixelData) {
+        for (var ibyte = 0; ibyte < 512; ibyte++) {
+          pixelData.set(palette[bytes[ibyte] >> 4], ibyte*8);
+          pixelData.set(palette[bytes[ibyte] & 15], ibyte*8 + 4);
+        }
+      });
+    });
   };
 
 });
Update icl4 to use new loader format