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

  'use strict';
  
  return function(resource) {
    if (resource.data.length !== 1024) {
      console.error('icl8 resource expected to be 1024 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 < 1024; ibyte++) {
      pix.data.set(palette[resource.data[ibyte]], ibyte*4);
    }
    ctx.putImageData(pix, 0, 0);
    resource.image = {url: img.toDataURL(), width:32, height:32};
  };

});

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

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

});

Change icl8 to use new resource format
Change icl8 to use new resource format