img isn't a graphic, as the blog post indicates.
sage: type(img)

The "right" thing to do is use imshow like here, but I can never figure out how to actually get it to show up in the notebook. But this might give you enough hints if you've used mpl in the past.