It is currently Wed Jun 26, 2024 5:10 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: LED-Animation Plug-in
PostPosted: Thu Mar 30, 2023 10:10 am  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3995
Location: Canada
Turn this image Image
Into the below animation
Image
or something like this where content is wider than LED panel (image size).
Image
Instructions:
1. Have a layer of your art/text that you'd like to animate as LED animation (as example above I used 80x40 image because each LED bulb will be 20x20 so it'll be quite large). Note: Layer can be wider than image size to animate more than just viewable content at once.
2. Run plug-in from /Python-fu/LED Animation...
3. It'll create a new image containing elements to animate with and another image containing animation frames (animation).
4. Resize/Scale down the image to decent size to animate with as the raw result is quite large (20x20 per pixel from original).
5. Save as animated gif and you're good.
6. That's it...Enjoy.

Here's the plug-in code (save as .py file [ie. LED-animation.py]):
#!/usr/bin/env python
# LED-animation.py
# Created by TT
#
# License: GPLv3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY# without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To view a copy of the GNU General Public License
# visit: http://www.gnu.org/licenses/gpl.html
#
#
# ------------
#| Change Log |
# ------------
# Rel 1: Initial release

from gimpfu import *
import random
import math
def python_LED_animation(image, layer):
   # pdb.gimp_image_undo_group_start(image)
   # pdb.gimp_context_push()
   #YOUR CODE BEGINS=======================
   ledsize = 20;
   new_image = pdb.gimp_image_duplicate(image)
   pdb.gimp_display_new(new_image)
   lightlayer = pdb.gimp_image_get_active_layer(new_image)
   pdb.gimp_image_scale_full(new_image,image.width*ledsize,image.height*ledsize,0)

   #make copy of of light layer in order to animate it
   lightlayercopy = pdb.gimp_layer_new_from_drawable(lightlayer,new_image)
   pdb.gimp_image_insert_layer(new_image,lightlayercopy,None,0)
   pdb.gimp_layer_set_offsets(lightlayercopy,lightlayer.width,0)
   lightlayer = pdb.gimp_image_merge_down(new_image,lightlayercopy,EXPAND_AS_NECESSARY)

   #create led light cover layer, LED layer that gives LED effect
   num_patterns,pattern_list = pdb.gimp_patterns_get_list("")
   pdb.gimp_context_set_pattern(pattern_list[0]) #Clipboard
   led = pdb.gimp_layer_new(new_image,ledsize,ledsize,RGBA_IMAGE,"led",100,LAYER_MODE_NORMAL)
   pdb.gimp_image_insert_layer(new_image,led,None,0)
   pdb.gimp_context_set_foreground((0,0,0))
   pdb.gimp_edit_fill(led,FILL_FOREGROUND)
   pdb.gimp_image_select_ellipse(new_image,CHANNEL_OP_REPLACE,2,2,16,16)
   pdb.gimp_edit_clear(led)
   pdb.gimp_image_select_rectangle(new_image,CHANNEL_OP_REPLACE,0,0,ledsize,ledsize)
   pdb.gimp_edit_copy(led)
   pdb.gimp_layer_resize(led,new_image.width,new_image.height,0,0)
   pdb.gimp_selection_none(new_image)
   pdb.gimp_edit_clear(led)
   pdb.gimp_edit_fill(led,FILL_PATTERN)

   #animation of LED
   animation_image = pdb.gimp_image_new(new_image.width,new_image.height,RGB)
   pdb.gimp_display_new(animation_image)
   for i in range(0,int(layer.width)):
      pdb.gimp_layer_set_offsets(lightlayer,-i*ledsize,0)
      new_frame = pdb.gimp_layer_new_from_visible(new_image,animation_image,"Animation Frame")
      pdb.gimp_image_insert_layer(animation_image,new_frame,None,0)

   #YOUR CODE ENDS ========================
   # pdb.gimp_context_pop()
   # pdb.gimp_image_undo_group_end(image)
   pdb.gimp_displays_flush()
    #return

register(
   "python_fu_LED_animation",
   "LED sign animation",
   "LED sign animation",
   "TT",
   "TT",
   "March 30, 2023",
   "<Image>/Python-Fu/LED Animation...",
   "*",      # Create a new image, don't work on an existing one
   [
   #INPUT BEGINS
   #(PF_TOGGLE, "method",   "Gray/Method:", 1), # initially True, checked.  Alias PF_BOOL
   # (PF_SPINNER, "colors", "Number of Maximum Colors (randomly):", 16, (1, 32, 1)),
   # (PF_TOGGLE, "varysize",   "Vary up sizes:", 1), # initially True, checked.  Alias PF_BOOL
   # (PF_TOGGLE, "colorbackground",   "Color background randomly:", 0), # initially True, checked.  Alias PF_BOOL
   #(PF_SPINNER, "inc", "Increments (pixels):", 15, (1, 1000, 1)),
   #(PF_SPINNER, "outof", "Best out of:", 100, (1, 1000, 1)),
   #(PF_OPTION, "arrow_side", "Arrows Ends:", SIDE_END, SIDE_NAMES),
   #(PF_TOGGLE, "arrow_close", "Arrows Close:", 0),
   #(PF_SPINNER, "ignorelayers", "Ignore first (no of layers):", 2, (0, 200, 1)),
   #(PF_SPINNER, "shadow_offset_x", "Shadow Offset X:", 6, (-4096,4096,1)),
   #(PF_SPINNER, "shadow_offset_y", "Shadow Offset Y:", 6, (-4096,4096,1)),
   #(PF_SPINNER, "shadow_blur_radius", "Shadow Blur Radius:", 15, (0,1024,1)),
   #(PF_SPINNER, "shadow_opacity", "Shadow Opacity:", 100, (0,100,1)),
   #INPUT ENDS
   ],
   [],
   python_LED_animation)

main()

#           (PF_INT, "p0", "_INT:", 0), # PF_INT8, PF_INT16, PF_INT32  similar but no difference in Python.
#           (PF_FLOAT, "p02", "_FLOAT:", 3.141),
#           (PF_STRING, "p03", "_STRING:", "foo"),  # alias PF_VALUE
#           (PF_TEXT, "p04", "TEXT:", "bar"),
#           # PF_VALUE
#           # Pick one from set of choices
#           (PF_OPTION,"p1",   "OPTION:", 0, ["0th","1st","2nd"]), # initially 0th is choice
#           (PF_RADIO, "p16", "RADIO:", 0, (("0th", 1),("1st",0))), # note bool indicates initial setting of buttons
#           # PF_RADIO is usually called a radio button group.
#           # SLIDER, ADJUSTMENT types require the extra parameter of the form (min, max, step).
#           (PF_TOGGLE, "p2",   "TOGGLE:", 1), # initially True, checked.  Alias PF_BOOL
#           # PF_TOGGLE is usually called a checkbox.
#           (PF_SLIDER, "p3", "SLIDER:", 0, (0, 100, 10)),
#           (PF_SPINNER, "p4", "SPINNER:", 21, (1, 1000, 50)),  # alias PF_ADJUSTMENT
#           # Pickers ie combo boxes ie choosers from lists of existing Gimp objects
#           (PF_COLOR, "p14", "_COLOR:", (100, 21, 40) ), # extra param is RGB triple
#           # PF_COLOUR is an alias by aussie PyGimp author lol
#           (PF_IMAGE, "p15", "IMAGE:", None), # should be type gimp.image, but None works
#           (PF_FONT, "p17", "FONT:", 0),
#           (PF_FILE, "p18", "FILE:", 0),
#           (PF_BRUSH, "p19", "BRUSH:", 0),
#           (PF_PATTERN, "p20", "PATTERN:", 0),
#           (PF_GRADIENT, "p21", "GRADIENT:", 0),
#           (PF_PALETTE, "p22", "PALETTE:", 0),
#           (PF_LAYER, "p23", "LAYER:", None),
#           (PF_CHANNEL, "p24", "CHANNEL:", None),  # ??? Usually empty, I don't know why.
#           (PF_DRAWABLE, "p25", "DRAWABLE:", None),
#           # Mostly undocumented, but work
#           (PF_VECTORS, "p26", "VECTORS:", None),
#           (PF_FILENAME, "p27", "FILENAME:", 0),
#           (PF_DIRNAME, "p28", "DIRNAME:", 0)
#           # PF_REGION might work but probably of little use.  See gimpfu.py.


_________________
TinT


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Thu Mar 30, 2023 11:08 am  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3995
Location: Canada
This version allows you to enter a percentage (odds to have broken LEDs).
Image
code below:
#!/usr/bin/env python
# LED-animation.py
# Created by TT
#
# License: GPLv3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY# without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To view a copy of the GNU General Public License
# visit: http://www.gnu.org/licenses/gpl.html
#
#
# ------------
#| Change Log |
# ------------
# Rel 1: Initial release
# Rel 2: Added Broken/Burnout Percentage to have broken LEDs

from gimpfu import *
import random
import math
def python_LED_animation(image, layer, burnout):
   # pdb.gimp_image_undo_group_start(image)
   # pdb.gimp_context_push()
   #YOUR CODE BEGINS=======================
   ledsize = 20;
   new_image = pdb.gimp_image_duplicate(image)
   pdb.gimp_display_new(new_image)
   lightlayer = pdb.gimp_image_get_active_layer(new_image)
   pdb.gimp_image_scale_full(new_image,image.width*ledsize,image.height*ledsize,0)

   #make copy of of light layer in order to animate it
   lightlayercopy = pdb.gimp_layer_new_from_drawable(lightlayer,new_image)
   pdb.gimp_image_insert_layer(new_image,lightlayercopy,None,0)
   pdb.gimp_layer_set_offsets(lightlayercopy,lightlayer.width,0)
   lightlayer = pdb.gimp_image_merge_down(new_image,lightlayercopy,EXPAND_AS_NECESSARY)

   #create led light cover layer, LED layer that gives LED effect
   num_patterns,pattern_list = pdb.gimp_patterns_get_list("")
   pdb.gimp_context_set_pattern(pattern_list[0]) #Clipboard
   led = pdb.gimp_layer_new(new_image,ledsize,ledsize,RGBA_IMAGE,"led",100,LAYER_MODE_NORMAL)
   pdb.gimp_image_insert_layer(new_image,led,None,0)
   pdb.gimp_context_set_foreground((0,0,0))
   pdb.gimp_edit_fill(led,FILL_FOREGROUND)
   pdb.gimp_image_select_ellipse(new_image,CHANNEL_OP_REPLACE,2,2,16,16)
   pdb.gimp_edit_clear(led)
   pdb.gimp_image_select_rectangle(new_image,CHANNEL_OP_REPLACE,0,0,ledsize,ledsize)
   pdb.gimp_edit_copy(led)
   pdb.gimp_layer_resize(led,new_image.width,new_image.height,0,0)
   pdb.gimp_selection_none(new_image)
   pdb.gimp_edit_clear(led)
   pdb.gimp_edit_fill(led,FILL_PATTERN)
   for y in range(0,image.height):
      for x in range(0,image.width):
         if (random.randrange(0,100)<burnout):
            pdb.gimp_image_select_rectangle(new_image,CHANNEL_OP_REPLACE,x*ledsize,y*ledsize,ledsize,ledsize)
            pdb.gimp_edit_fill(led,FILL_FOREGROUND)
   pdb.gimp_selection_none(new_image)         
   #animation of LED
   animation_image = pdb.gimp_image_new(new_image.width,new_image.height,RGB)
   pdb.gimp_display_new(animation_image)
   for i in range(0,int(layer.width)):
      pdb.gimp_layer_set_offsets(lightlayer,-i*ledsize,0)
      new_frame = pdb.gimp_layer_new_from_visible(new_image,animation_image,"Animation Frame")
      pdb.gimp_image_insert_layer(animation_image,new_frame,None,0)

   #YOUR CODE ENDS ========================
   # pdb.gimp_context_pop()
   # pdb.gimp_image_undo_group_end(image)
   pdb.gimp_displays_flush()
    #return

register(
   "python_fu_LED_animation",
   "LED sign animation",
   "LED sign animation",
   "TT",
   "TT",
   "March 30, 2023",
   "<Image>/Python-Fu/LED Animation...",
   "*",      # Create a new image, don't work on an existing one
   [
   #INPUT BEGINS
   (PF_INT, "burnout", "Burnout/Broken (Bulbs) Percentage:", 5), # PF_INT8, PF_INT16, PF_INT32  similar but no difference in Python.   
   #(PF_TOGGLE, "method",   "Gray/Method:", 1), # initially True, checked.  Alias PF_BOOL
   # (PF_SPINNER, "colors", "Number of Maximum Colors (randomly):", 16, (1, 32, 1)),
   # (PF_TOGGLE, "varysize",   "Vary up sizes:", 1), # initially True, checked.  Alias PF_BOOL
   # (PF_TOGGLE, "colorbackground",   "Color background randomly:", 0), # initially True, checked.  Alias PF_BOOL
   #(PF_SPINNER, "inc", "Increments (pixels):", 15, (1, 1000, 1)),
   #(PF_SPINNER, "outof", "Best out of:", 100, (1, 1000, 1)),
   #(PF_OPTION, "arrow_side", "Arrows Ends:", SIDE_END, SIDE_NAMES),
   #(PF_TOGGLE, "arrow_close", "Arrows Close:", 0),
   #(PF_SPINNER, "ignorelayers", "Ignore first (no of layers):", 2, (0, 200, 1)),
   #(PF_SPINNER, "shadow_offset_x", "Shadow Offset X:", 6, (-4096,4096,1)),
   #(PF_SPINNER, "shadow_offset_y", "Shadow Offset Y:", 6, (-4096,4096,1)),
   #(PF_SPINNER, "shadow_blur_radius", "Shadow Blur Radius:", 15, (0,1024,1)),
   #(PF_SPINNER, "shadow_opacity", "Shadow Opacity:", 100, (0,100,1)),
   #INPUT ENDS
   ],
   [],
   python_LED_animation)

main()

#           (PF_INT, "p0", "_INT:", 0), # PF_INT8, PF_INT16, PF_INT32  similar but no difference in Python.
#           (PF_FLOAT, "p02", "_FLOAT:", 3.141),
#           (PF_STRING, "p03", "_STRING:", "foo"),  # alias PF_VALUE
#           (PF_TEXT, "p04", "TEXT:", "bar"),
#           # PF_VALUE
#           # Pick one from set of choices
#           (PF_OPTION,"p1",   "OPTION:", 0, ["0th","1st","2nd"]), # initially 0th is choice
#           (PF_RADIO, "p16", "RADIO:", 0, (("0th", 1),("1st",0))), # note bool indicates initial setting of buttons
#           # PF_RADIO is usually called a radio button group.
#           # SLIDER, ADJUSTMENT types require the extra parameter of the form (min, max, step).
#           (PF_TOGGLE, "p2",   "TOGGLE:", 1), # initially True, checked.  Alias PF_BOOL
#           # PF_TOGGLE is usually called a checkbox.
#           (PF_SLIDER, "p3", "SLIDER:", 0, (0, 100, 10)),
#           (PF_SPINNER, "p4", "SPINNER:", 21, (1, 1000, 50)),  # alias PF_ADJUSTMENT
#           # Pickers ie combo boxes ie choosers from lists of existing Gimp objects
#           (PF_COLOR, "p14", "_COLOR:", (100, 21, 40) ), # extra param is RGB triple
#           # PF_COLOUR is an alias by aussie PyGimp author lol
#           (PF_IMAGE, "p15", "IMAGE:", None), # should be type gimp.image, but None works
#           (PF_FONT, "p17", "FONT:", 0),
#           (PF_FILE, "p18", "FILE:", 0),
#           (PF_BRUSH, "p19", "BRUSH:", 0),
#           (PF_PATTERN, "p20", "PATTERN:", 0),
#           (PF_GRADIENT, "p21", "GRADIENT:", 0),
#           (PF_PALETTE, "p22", "PALETTE:", 0),
#           (PF_LAYER, "p23", "LAYER:", None),
#           (PF_CHANNEL, "p24", "CHANNEL:", None),  # ??? Usually empty, I don't know why.
#           (PF_DRAWABLE, "p25", "DRAWABLE:", None),
#           # Mostly undocumented, but work
#           (PF_VECTORS, "p26", "VECTORS:", None),
#           (PF_FILENAME, "p27", "FILENAME:", 0),
#           (PF_DIRNAME, "p28", "DIRNAME:", 0)
#           # PF_REGION might work but probably of little use.  See gimpfu.py.


_________________
TinT


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Thu Mar 30, 2023 11:40 am  (#3) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3995
Location: Canada
This version (3) has flickering percentage input.
Image

Here's the code:
#!/usr/bin/env python
# LED-animation.py
# Created by TT
#
# License: GPLv3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY# without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To view a copy of the GNU General Public License
# visit: http://www.gnu.org/licenses/gpl.html
#
#
# ------------
#| Change Log |
# ------------
# Rel 1: Initial release
# Rel 2: Added Broken/Burnout Percentage to have broken LEDs
# Rel 3: Added Flicker Percentage to have the whole panel flicker.

from gimpfu import *
import random
import math
def python_LED_animation(image, layer, burnout, flicker):
   # pdb.gimp_image_undo_group_start(image)
   # pdb.gimp_context_push()
   #YOUR CODE BEGINS=======================
   ledsize = 20;
   new_image = pdb.gimp_image_duplicate(image)
   pdb.gimp_display_new(new_image)
   lightlayer = pdb.gimp_image_get_active_layer(new_image)
   pdb.gimp_image_scale_full(new_image,image.width*ledsize,image.height*ledsize,0)

   #make copy of of light layer in order to animate it
   lightlayercopy = pdb.gimp_layer_new_from_drawable(lightlayer,new_image)
   pdb.gimp_image_insert_layer(new_image,lightlayercopy,None,0)
   pdb.gimp_layer_set_offsets(lightlayercopy,lightlayer.width,0)
   lightlayer = pdb.gimp_image_merge_down(new_image,lightlayercopy,EXPAND_AS_NECESSARY)

   #create led light cover layer, LED layer that gives LED effect
   num_patterns,pattern_list = pdb.gimp_patterns_get_list("")
   pdb.gimp_context_set_pattern(pattern_list[0]) #Clipboard
   led = pdb.gimp_layer_new(new_image,ledsize,ledsize,RGBA_IMAGE,"led",100,LAYER_MODE_NORMAL)
   pdb.gimp_image_insert_layer(new_image,led,None,0)
   pdb.gimp_context_set_foreground((0,0,0))
   pdb.gimp_edit_fill(led,FILL_FOREGROUND)
   pdb.gimp_image_select_ellipse(new_image,CHANNEL_OP_REPLACE,2,2,16,16)
   pdb.gimp_edit_clear(led)
   pdb.gimp_image_select_rectangle(new_image,CHANNEL_OP_REPLACE,0,0,ledsize,ledsize)
   pdb.gimp_edit_copy(led)
   pdb.gimp_layer_resize(led,new_image.width,new_image.height,0,0)
   pdb.gimp_selection_none(new_image)
   pdb.gimp_edit_clear(led)
   pdb.gimp_edit_fill(led,FILL_PATTERN)
   for y in range(0,image.height):
      for x in range(0,image.width):
         if (random.randrange(0,100)<burnout):
            pdb.gimp_image_select_rectangle(new_image,CHANNEL_OP_REPLACE,x*ledsize,y*ledsize,ledsize,ledsize)
            pdb.gimp_edit_fill(led,FILL_FOREGROUND)
   pdb.gimp_selection_none(new_image)         
   #animation of LED
   animation_image = pdb.gimp_image_new(new_image.width,new_image.height,RGB)
   pdb.gimp_display_new(animation_image)
   for i in range(0,int(layer.width)):
      pdb.gimp_layer_set_offsets(lightlayer,-i*ledsize,0)
      new_frame = pdb.gimp_layer_new_from_visible(new_image,animation_image,"Animation Frame")
      pdb.gimp_image_insert_layer(animation_image,new_frame,None,0)
      if (random.randrange(0,100)<flicker):
         pdb.gimp_edit_fill(new_frame,FILL_FOREGROUND)


   #YOUR CODE ENDS ========================
   # pdb.gimp_context_pop()
   # pdb.gimp_image_undo_group_end(image)
   pdb.gimp_displays_flush()
    #return

register(
   "python_fu_LED_animation",
   "LED sign animation",
   "LED sign animation",
   "TT",
   "TT",
   "March 30, 2023",
   "<Image>/Python-Fu/LED Animation...",
   "*",      # Create a new image, don't work on an existing one
   [
   #INPUT BEGINS
   (PF_INT, "burnout", "Burnout/Broken (Bulbs) Percentage:", 5), # PF_INT8, PF_INT16, PF_INT32  similar but no difference in Python.   
   (PF_INT, "flicker", "Flicker Percentage:", 5), # PF_INT8, PF_INT16, PF_INT32  similar but no difference in Python.   
   #(PF_TOGGLE, "method",   "Gray/Method:", 1), # initially True, checked.  Alias PF_BOOL
   # (PF_SPINNER, "colors", "Number of Maximum Colors (randomly):", 16, (1, 32, 1)),
   # (PF_TOGGLE, "varysize",   "Vary up sizes:", 1), # initially True, checked.  Alias PF_BOOL
   # (PF_TOGGLE, "colorbackground",   "Color background randomly:", 0), # initially True, checked.  Alias PF_BOOL
   #(PF_SPINNER, "inc", "Increments (pixels):", 15, (1, 1000, 1)),
   #(PF_SPINNER, "outof", "Best out of:", 100, (1, 1000, 1)),
   #(PF_OPTION, "arrow_side", "Arrows Ends:", SIDE_END, SIDE_NAMES),
   #(PF_TOGGLE, "arrow_close", "Arrows Close:", 0),
   #(PF_SPINNER, "ignorelayers", "Ignore first (no of layers):", 2, (0, 200, 1)),
   #(PF_SPINNER, "shadow_offset_x", "Shadow Offset X:", 6, (-4096,4096,1)),
   #(PF_SPINNER, "shadow_offset_y", "Shadow Offset Y:", 6, (-4096,4096,1)),
   #(PF_SPINNER, "shadow_blur_radius", "Shadow Blur Radius:", 15, (0,1024,1)),
   #(PF_SPINNER, "shadow_opacity", "Shadow Opacity:", 100, (0,100,1)),
   #INPUT ENDS
   ],
   [],
   python_LED_animation)

main()

#           (PF_INT, "p0", "_INT:", 0), # PF_INT8, PF_INT16, PF_INT32  similar but no difference in Python.
#           (PF_FLOAT, "p02", "_FLOAT:", 3.141),
#           (PF_STRING, "p03", "_STRING:", "foo"),  # alias PF_VALUE
#           (PF_TEXT, "p04", "TEXT:", "bar"),
#           # PF_VALUE
#           # Pick one from set of choices
#           (PF_OPTION,"p1",   "OPTION:", 0, ["0th","1st","2nd"]), # initially 0th is choice
#           (PF_RADIO, "p16", "RADIO:", 0, (("0th", 1),("1st",0))), # note bool indicates initial setting of buttons
#           # PF_RADIO is usually called a radio button group.
#           # SLIDER, ADJUSTMENT types require the extra parameter of the form (min, max, step).
#           (PF_TOGGLE, "p2",   "TOGGLE:", 1), # initially True, checked.  Alias PF_BOOL
#           # PF_TOGGLE is usually called a checkbox.
#           (PF_SLIDER, "p3", "SLIDER:", 0, (0, 100, 10)),
#           (PF_SPINNER, "p4", "SPINNER:", 21, (1, 1000, 50)),  # alias PF_ADJUSTMENT
#           # Pickers ie combo boxes ie choosers from lists of existing Gimp objects
#           (PF_COLOR, "p14", "_COLOR:", (100, 21, 40) ), # extra param is RGB triple
#           # PF_COLOUR is an alias by aussie PyGimp author lol
#           (PF_IMAGE, "p15", "IMAGE:", None), # should be type gimp.image, but None works
#           (PF_FONT, "p17", "FONT:", 0),
#           (PF_FILE, "p18", "FILE:", 0),
#           (PF_BRUSH, "p19", "BRUSH:", 0),
#           (PF_PATTERN, "p20", "PATTERN:", 0),
#           (PF_GRADIENT, "p21", "GRADIENT:", 0),
#           (PF_PALETTE, "p22", "PALETTE:", 0),
#           (PF_LAYER, "p23", "LAYER:", None),
#           (PF_CHANNEL, "p24", "CHANNEL:", None),  # ??? Usually empty, I don't know why.
#           (PF_DRAWABLE, "p25", "DRAWABLE:", None),
#           # Mostly undocumented, but work
#           (PF_VECTORS, "p26", "VECTORS:", None),
#           (PF_FILENAME, "p27", "FILENAME:", 0),
#           (PF_DIRNAME, "p28", "DIRNAME:", 0)
#           # PF_REGION might work but probably of little use.  See gimpfu.py.

_________________
TinT


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Thu Mar 30, 2023 7:04 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Dec 09, 2018
Posts: 656
Hi Tim,

When you said it gets quite large you weren't kidding! In the end I went for a small image size about what you suggested and scaled the animation image down a lot using interpolation none for speed.

My first try went a bit wrong so I think other requirements are:
The layer of art/text to be animated should be:
The active layer.
The top layer in the image.
The same height as the image.
All other layers will be the animation background.
It's best if the background is all black.

Attachment:
santa.gif
santa.gif [ 760.97 KiB | Viewed 1080 times ]


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Thu Mar 30, 2023 9:00 pm  (#5) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3995
Location: Canada
yes you're right. Nice one

_________________
TinT


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Fri Mar 31, 2023 5:42 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 787
Location: SEA - South East Asia
teapot wrote:
Hi Tim,

When you said it gets quite large you weren't kidding! In the end I went for a small image size about what you suggested and scaled the animation image down a lot using interpolation none for speed.

My first try went a bit wrong so I think other requirements are:
The layer of art/text to be animated should be:
The active layer.
The top layer in the image.
The same height as the image.
All other layers will be the animation background.
It's best if the background is all black.

Attachment:
The attachment santa.gif is no longer available


@teapot, you were not kidding too... :mrgreen:
I did not expect that huge size from a 250x100 px original image to become a 10 GB in GIMP! :huh
Attachment:
screenshot_20230331-173239.jpg
screenshot_20230331-173239.jpg [ 21.53 KiB | Viewed 1038 times ]

Thanks for the tips @teapot > The same height as the image., :bigthup
I confirm, same height or you will have 2 lines which was my first try...

@Tim, that's a very nice plugin, I love the effect :clap :tyspin
Maybe can you give us the possibility to chose the maximum number of frames as an option?

Image

_________________
Patrice


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Fri Mar 31, 2023 7:53 am  (#7) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3995
Location: Canada
The problem is each frame is one pixel movement....so an option to skip frames might not work out smoothly as the width might not divide evenly...
Let me know how you want to create frames if numbers don't divide evenly and I'll add it...

_________________
TinT


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Sat Apr 01, 2023 12:35 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 787
Location: SEA - South East Asia
trandoductin wrote:
The problem is each frame is one pixel movement....so an option to skip frames might not work out smoothly as the width might not divide evenly...
Let me know how you want to create frames if numbers don't divide evenly and I'll add it...


I would say round the number up, I'll try to explain (if I understood what you are asking) :oops:

For example User want maximum 63 frames, but numbers don't divide, but 72 is a good multiple, script will do 72, IMHO it's better to have just a little bit more frames than asked, than less :bigthup
If user do not input a number of frame, script works as it is working right now ;)

It just come to my mind, "what could be the very minimum number of frames that a user could ask?"
I would say 2 to 10, maybe the user want to use your script for something else (as usual, programmer programs for a specific purpose and users use it for a completely different purpose :rofl )

_________________
Patrice


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Sat Apr 01, 2023 1:39 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
Excellent marquee animation Tran. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: LED-Animation Plug-in
PostPosted: Sun Apr 02, 2023 5:29 pm  (#10) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3995
Location: Canada
Thanks Lyle. :D

_________________
TinT


Top
Post new topic Reply to topic  [ 10 posts ] 

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 Seamless Gif Animation plug-in

0

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