Please see the bug in noted in the comment. Onload is fired before decoding is complete which results in some flicker.