Fix call to `image.getContext2d()`

As the function is declared inline, it is not output unless the subject looks like a CanvasElement
to the compiler.  As the `image` variable is dynamic, it must be cast for `getContext2d` to work.