I have a quick Dart question. Is the width and height attributes of the ImageElement class not fully implemented yet? I can see they go in the constructor, but apparently they are not updated if you load an image dynamically, like this:
ImageElement image = new ImageElement();
image.src = 'whatever.jpg';
image.on.load.add((event) {
window.console.log(image.width); // Will always print 0.
});
Your code prints valid widths and heights for both PNGs and JPEGs.
Probably you have a buggy Dart SDK version. Update your Dart SDK.
Or maybe the image path is wrong, try an absolute path like: http://www.dartlang.org/imgs/dart-logo.png