It is currently Fri Jun 28, 2024 11:26 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Seamless Gif Animation plug-in
PostPosted: Thu Apr 13, 2023 9:36 am  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3997
Location: Canada
Just saving it here for future reference if I need to use it.
It just runs on an animated gif (that's in RGB mode) and produces overlay fades so that it animates seamlessly.
from gimpfu import *
import random
import math
def python_loop_gif_tt(image, layer):
   pass
   #return
   new_image = pdb.gimp_image_new(image.width,image.height,RGB)
   display_new = pdb.gimp_display_new(new_image)
   total_layers = len(image.layers) #120 when first tested
   mid_layer = total_layers/2

   bottom_layer = total_layers
   for i in range(bottom_layer,mid_layer,-1): #loop from bottom layer to midlayer
      lower_layer = pdb.gimp_layer_new_from_drawable(image.layers[i-1],new_image)
      pdb.gimp_image_insert_layer(new_image,lower_layer,None,0)
      upper_layer = pdb.gimp_layer_new_from_drawable(image.layers[(i-1+mid_layer)%total_layers],new_image)
      pdb.gimp_image_insert_layer(new_image,upper_layer,None,0)
      pdb.gimp_layer_set_opacity(upper_layer,min(100,(i-mid_layer)*100/mid_layer)) #this goes from fades from 100 to 0
      pdb.gimp_image_merge_down(new_image,upper_layer,CLIP_TO_IMAGE)
   for i in range(mid_layer,0,-1): #loop from mid layer to first layer
      lower_layer = pdb.gimp_layer_new_from_drawable(image.layers[i-1],new_image)
      pdb.gimp_image_insert_layer(new_image,lower_layer,None,0)
      upper_layer = pdb.gimp_layer_new_from_drawable(image.layers[(i-1+mid_layer)%total_layers],new_image)
      pdb.gimp_image_insert_layer(new_image,upper_layer,None,0)
      pdb.gimp_layer_set_opacity(upper_layer,100-min(100,(i*100/mid_layer))) #this goes from 0 to 100
      pdb.gimp_image_merge_down(new_image,upper_layer,CLIP_TO_IMAGE)

register(
   "python_fu_loop_gif_tt",
   "Loop Gif",
   "Loop Gif",
   "Tin Tran",
   "Tin Tran",
   "November 2022",
   "<Image>/Python-Fu/Loop Gif",             #Menu path
   "RGB*, GRAY*",
   [
   #(PF_BRUSH, "brush", "Brush:", 0),
   #(PF_SPINNER, "brush_size", "Brush-size:", 25, (1, 1000, 1)),
   #(PF_SPINNER, "brush_spacing", "Brush-spacing:", 5, (1, 1000, 1)),
   #(PF_SPINNER, "offset_angle", "Offset angle (angle to offset from path's angles):", 0, (0,360, 1)),
   #(PF_TOGGLE, "random_angle",   "Use random angle (when doing generally round blotches):", 0),
   #(PF_SPINNER, "px_height", "Height of each tile image:", 100, (1, 1000, 50)),
   ],
   [],
   python_loop_gif_tt)

main()

_________________
TinT


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) LED Animation from Animation Plug-in

6

No new posts Attachment(s) LED-Animation Plug-in

9

No new posts Attachment(s) Bring-in Animation Plug-in

23

No new posts Attachment(s) Sliding-into-Place Animation Plug-in

5

No new posts Attachment(s) Don't work procedures plug-in-bump-map, plug-in-displace

2



* Login  



Powered by phpBB3 © phpBB Group