Fixed the differencing of images for the webagg/nbagg backends.

In #3552 I improved the ability to handle images with transparency in the webagg/nbagg backends. Unfortunately, in doing so, I managed to break the differencing mode by always clearing the existing image on the javascript side. This change fixes the issue by keeping track of the image mode in the backend and notifying the client of any changes (as a result of transparency appearing).
> I don't see the benefit of being picky here.

Its such as moot point, I'm happy to change it, but I equally don't see any benefit of accepting ``MoDe`` as a valid input. It adds interface/code complexity (admittedly the complexity gain is trivial) for zero benefit IMHO.