Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Animated GIF Support
#1
Music 
Just a quick question... I read through the wiki and couldn't see any relevant info and I was wondering: does the BiblioPixel library support animated GIFs?
#2
Yup: https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/master/BiblioPixelAnimations/matrix/ImageAnim.py
#3
(01-01-2016, 05:31 PM)Adam Wrote: Yup: https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/master/BiblioPixelAnimations/matrix/ImageAnim.py

Cool. A followup question from an innocent bystander: is this a good approach to program a random non-linear animation if I am lacking the skills to put it in a formula? I have a 3 m (144 LEDs) strip and might be more capable to create a 1 x 144 pixel animated GIF.
#4
Kind of depends on what you want to do... animated GIFs are only available on LEDMatrix though, you cannot do it on a strip.
Well... you could cheat and use a 144x1 LEDMatrix.
What did you have in mind?
#5
Thank you Adam for your quick reply. I think, unless there is a better option, I will pretend to have an 1 x 144 matrix. Just to see if I can actually do this I tried to generate an animated GIF with Photoshop (I've never done this before):



It is symmetrical and can probably be accomplished programmatically yet for me this is a proof of concept.


Attached Files Thumbnail(s)
   
#6
Ah... the easiest and cheat way would be to store a list of lists of colors tuples....
For example, if your animation was 3 frames for a 3 pixel string:

frames = [
[(0,255,0), (255,0,0), (0,255,0)], #green, red, green
[(0,255,0), (0,0,255), (0,255,0)], #green, blue, green
[(255,255,0), (0,0,0), (255,255,0)], #orange, black, orange
]

And then run through that and display each frame. But... honestly, the gif is easier. I'm sure you could do it algorithmically, but not sure what your needed algorithm would need to be.
#7
Bummer. ImageAnim, although I can see it being loaded in the the console, doesn't show up in the web interface. :( (Yes, other matrix animations show up.)

BTW, my Raspberry Pi running Jessie chocked on SSL when downloading/updating animations:
Code:
$ sudo pip install https://github.com/ManiacalLabs/BiblioPixelAnimations/archive/master.zip --upgrade

Downloading/unpacking https://github.com/ManiacalLabs/BiblioPixelAnimations/archive/master.zip
  Downloading master.zip (unknown size): 53kB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 256, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 186, in read
    data = self._fp.read(amt)
  File "/usr/lib/python2.7/httplib.py", line 573, in read
    s = self.fp.read(amt)
  File "/usr/lib/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 188, in recv
    data = self.connection.recv(*args, **kwargs)
ZeroReturnError

Storing debug log for failure in /root/.pip/pip.log

With http it worked.

(01-04-2016, 04:59 PM)Adam Wrote: Ah... the easiest and cheat way would be to store a list of lists of colors tuples....

Yes. I thought about that. Yet, rather than writing out the tuples we already have this nice way to represent points in colors: graphics. And a picture is worth thousand words (or tuples, if you will).

(01-04-2016, 05:11 PM)Buhlinky Wrote: Bummer. ImageAnim, although I can see it being loaded in the the console, doesn't show up in the web interface. :( (Yes, other matrix animations show up.)

Never mind, a complete reload helped.
#8
I created a 1x144 animation that cycles through R-G-B-RGB-W-C-M-Y-CMY-K (attached). No matter what I set the pixel color order in the settings of PixelWeb only blue shows up as expected (the order for my strip is BRG). Am I doing something wrong, is it because of my fake matrix or is there an error in the code?


Attached Files Thumbnail(s)
   
#9
Hmm... weird. Can you send your whole script?
#10
(01-05-2016, 12:42 PM)Adam Wrote: Hmm... weird. Can you send your whole script?

Thank you Adam for the quick response. I am not sure what you mean with script. I use PixelWeb, change the settings from LED strip (144 LEDs wide, channel order BRG) to LED matrix (width 144, height 1, same channel order), select ImageAnim and enter the path to the gif. Which script could I send?

(Just in case you are referring to this I attach /usr/local/lib/python2.7/dist-packages/BiblioPixelAnimations/matrix/ImageAnim.py - I had to change the extension since your forum didn't like the py)


Attached Files
.txt   ImageAnim_py.txt (Size: 7.08 KB / Downloads: 1)


Forum Jump:


Users browsing this thread: 1 Guest(s)