Skip to content

Instantly share code, notes, and snippets.

@GauntletWizard
Created October 31, 2017 20:47
Show Gist options
  • Save GauntletWizard/ea773257000de2fc5b8f6b15bc7a53f9 to your computer and use it in GitHub Desktop.
Save GauntletWizard/ea773257000de2fc5b8f6b15bc7a53f9 to your computer and use it in GitHub Desktop.
Animate a transition between two images in GIMP.
# Find our image, and first and last images.
# Gimp GIF export animates from bottom to top, so these are backwards.
foo = gimp.image_list()[0]
start = foo.layers[0]
end = foo.layers[1]
start.visible = False
end.visible = False
# Step - How much we increase opacity each time.
step = 5
for op in xrange(0, 100, step):
snew = start.copy()
enew = end.copy()
print enew.opacity
snew.opacity = float(op)
enew.opacity = 100.0 - op
foo.add_layer(enew, 1)
foo.add_layer(snew, 2)
enew.visible = True
snew.visible = True
foo.merge_down(enew, EXPAND_AS_NECESSARY)
start.visible = True
end.visible = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment