There is a simple method to do it:
Open the images as two layers, run Filters - Animation - Optimize (Difference), you should get the same resulting image that is now made of the bottom layer and a diff layer on top of it.
The things get complicated only if you have partial transparency, because the filter removes it.
Here is a workaround I've found for this case:
- Remove Alpha Channel on both layers (the action is in the context menu)
The images will receive white background, but don't worry, we'll undo it later.
- Filters - Animation - Optimize (Difference)
Now we have the difference layer with white background in places of partial transparency, but we need those pixels to be transparent, so we'll take the shape of the diff and copy the image of this shape from the original top layer. Ensure the newly generated diff layer is selected and continue:
- Layer - Layer to Image Size
- Edit - Copy (Ctrl+C)
- Return to the original image
- Undo, Undo to return transparency to our layers
- Edit - Paste as - New Layer
- Alpha to Selection (in the context menu) on the pasted diff layer
- Delete the pasted diff layer
- Ensure that the top layer is selected and Copy (Ctrl+C) from it
- Now you have the diff, just Paste (Ctrl+V) it and create a new layer from it.
Of course, no magic happens, and the partially transparent top layer won't alter colors or reduce transparency of the bottom layer, so it's only for cases of extension, where the altered pixels of the top layer cover the bottom layer.
P.S. jsbueno's method didn't work out for me.