Shop OBEX P1 Docs P2 Docs Learn Events
Animated GIFs on the Propeller — Parallax Forums

Animated GIFs on the Propeller

LoopyBytelooseLoopyByteloose Posts: 12,537
edited 2011-08-02 08:16 in Propeller 1
Hi folks. I just came across a handy (and fun) free program called Pencil V0.42. It seems to be stable and free and available in Linux, Windows, and OSX.

So I am wondering if anyone has managed to run animated GIF or other animated file formats on a Propeller platform.

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-07-31 08:20
    Here is where to get Pencil.


    http://www.pencil-animation.org/

    BTW, it seems that Pencil is in PNG format, not GIF. There is some history of a patent for GIF restricting its use and so PNG was developed for open source. I need to do more reading about this, but Bit-mapped color is an available data form.
  • PerryPerry Posts: 253
    edited 2011-07-31 10:27
    Interesting stuf.
    If you read the graphics demo you see the use of "sprites" they are like animated gifs.

    Phil Pilgrim did some excellent work on 3d Glasses http://forums.parallax.com/showthread.php?113594-Okay-boys-and-girls-grab-your-3D-glasses-and-gather-round-the-TV-%28or-VGA%29.-.&highlight=3d_graphics

    That could be considered similar to the SVG format.?

    Perry
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-07-31 11:37
    Not sure I can answer your question about SVG format. I am posting more for assistance than for mentoring. I wonder if SVG format is more effort than the other alternatives. Pencil seems to indeed generate SVG format in some situations. There are a lot of formats for these tiny animations, but one must be a better entry point due to [1] simplicity of the format and [2} compatibility with Propellers ability.

    I have been playing with Pencil mainly to develop some skills as an animator. It is quite wonderful and an excellent software to develop some knowledge of what limited graphic animations can do. It does seem to have a downside as I was hoping that a file generated by it would be able to be directly loaded into an SD memory card and read by the Propeller, which would then work its magic on it to produce a video output.

    That may not be as easy as it seems.
    Pencil seems to want to output in file formats which are more sophisticated that GIF. GIF seems at first glance to be a better fit for the Propeller because it is less sophisticated, includes animation directly, and Wikipedia presents it fairly clearly.

    I do have an alternative animation software (in Linux) to Pencil. Linux's GIMP has an animation add-on called Gimp-Gap in Ubuntu. That generates GIF files. And after learning Pencil, I can see it is rather easy to play will.

    So at present, I am looking at what it would take to open a file from an SDcard, read the header data and then download data for animation into the Propeller.

    Sprites are very similar, but technically intended to move over a background. At this point, I just want to display animations that move about within a defined frame as provided by the file. I suppose later, you could also move them about the larger display area - if Propeller has any resources left to do so.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-07-31 11:41
    Well, look at my avatar for a great little animation. It's a great old-school one, showing the classic forms. Only 30K too! Love things like that.

    Props could probably render 16 color gifs at a good resolution, fetched from SD card. They could do my avatar easily enough.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-07-31 11:44
    GIF is a compressed format, so the Propeller would have to uncompress and render each frame in real time. The compression method used is LZW, which can entail the creation of rather large in-memory tables to deal with. Here's an article that details the GIF format:

    -Phil
  • potatoheadpotatohead Posts: 10,261
    edited 2011-07-31 12:05
    Are all GIF's compressed? Answer: Yes. (I just looked) Trick, uncompressed ones are larger than bitmaps of the same size... Bummer. Not a good fit for a prop then.

    Well, simple flip page bitmap animations could be rendered easily enough, then converted to GIF later, I suppose.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-07-31 12:34
    Both Pencil and Gimp+Gap seem able to generate individual files for each image. Would that be 'flip page' without the compression?

    If so, this still may be a viable project. I guess it would just be a series of JPEG files.

    @potatohead I've long admired your animated avatar. Now I am finding they are quite easy to DIY and am more interested than ever.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-07-31 13:19
    Be sure to show off your work. I would love to see it. I'm a kind of crappy animator, who enjoys seeing great, short animations. :)

    IMHO, if those files are simple BMP files, maybe 16 color, then yes, that's flip page. A bunch of them could be put on SD, maybe with sequential names and displayed. Props can move the data easily enough. We've got movies playing on them. As Phil noted, RAM is tight, which takes real time decompression off the table.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-07-31 16:21
    We do have animation in the form of movies, so you would need to do some pre-processing. Convert each GIF frame to a bitmap, then convert the bitmap to the propeller color palette numbers. For better results, use dithering.

    I am doing processing using vb.net because you can import pictures in a number of formats into a picturebox, resize it, scale it, crop it, and then convert the picturebox into an array, and then convert that array into any format you like. If you wanted to do the same thing on the propeller you need to get inside the format - .bmp, .jpg.gif and work out how it is stored. I've decoded the .bmp format but not the others. There might be code out on the interweb somewhere.

    Have you got an animated .gif? Give me a few days and I'll see what I can do with it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-08-01 01:27
    Thanks, preprocessing sounds like the best way to go. I would be 'nice' to just have the Propeller open a GIF file and use it, but apparently the compression is an obstacle. JPEGs are yet another compression scheme. BMP files might be okay for individual images. But all this gets to be more distracting than helping.

    As of now, I just started with Pencil and Gimp+Gap. So I don't have any original animations worth showing or converting. But by keeping them simple - like black and white line drawings - the finished product should be rather easy to convert to 'ready data' for the Propeller.

    I will get back into Andre LeMothe's Hydra text and see what I have questions about. But I am still wondering if I should be storing the image data on an SDcard in a file. I do now realize that file might be a homemade format that comes out of the conversion process rather than some standard.

    BMP format seems to be a good starting point for now as it seems there is not distraction of a compression process.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-08-01 05:05
    I spent some time today with Pencil and I now understand that it creates a Folder with a series of PNG files that are driven by Pencil with a related HTML file.

    This certainly isn't GIF. So I am leaning toward exploring what Gimp+Gap will allow me to produce in graphics. Both Pencil and Gimp+Gap are FREE.

    Regarding graphic file conversions, I recalled an 'old friend' called ImageMagick. This is a Linux utility program that is very handy if you have a lot to reformat for a web site. It also seems just as handy to take a series of PNG files and convert them to whatever size and format is suitable for Propeller input.

    http://www.imagemagick.org/script/index.php

    Again this is free and available for Windows, OSX, and Linux.

    Pencil can do nice Bit-mapped graphics and save them for animated use. But the other choice, Vectored graphics may not be fully developed. So one has to take care to know what one can and cannot do in the application. SVG appears to NOT be quite ready.

    So it does seem that Pencil used in conjunction with ImageMagick might create a series of BMP files with limited color that would go into the Propeller as an animated video.

    And, all the software seems to be FREE and available in Windows, OSX, and Linux. But, some study is required.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-08-01 07:29
    Hi Loopy,
    So I am wondering if anyone has managed to run animated GIF or other animated file formats on a Propeller platform.

    I took your animated GIF from your avatar and put him on the propeller :)

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-08-01 11:15
    Very VERY impressive. That is not original work by me, but if it is that easy for you to migrate a GIF to the Propeller I'd love to know how.

    Pencil has NOT worked out. It is easy to create an animation, but it is not in a file format that is easy to export or convert. I have moved on to studying Gimp+Gap as a much superior 2D animation software. The only problem is it is a bit slower to learn.

    And so.....
    Are you going to tell us how the GIF was migrated? In particular, the hardware involved with the Propeller, the graphic display object, and what ever adjustments were necessary to get it to work.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-08-01 11:22
    @DrA: That is impressive! At risk of going slight off-topic, what is your setup we see in the video?

    OBC
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-08-01 16:39
    Sorry I didn't get a chance to write it up - I put that together at midnight after an 18 hour work day (my world is a waiting room full of crying children with earaches). But I have been able to vent in a most appropriate way on OBC's thread here http://forums.parallax.com/showthread.php?133472-Survey-What-gets-in-the-way-of-your-Propeller-projects

    I'll post the code when I get home, but the steps are:
    1) Grab the .gif file - right click and "save as".
    2) Download the video converter part of AVS4YOU http://www.avs4you.com/AVS-Video-Converter.aspx
    3) Open up the .gif (or any movie format really)
    4) Click on Edit along the top and there is an option to "export all bitmaps".
    5) Convert these using the vb.net program I have written (I'm at work at the moment but when I get home I'll post the source code)

    I've added a number of things to the vb.net code, including scaling and cropping and dithering. Test it first on single images before running the code to convert all the bitmaps in one go.

    6) Copy the .tvm file to an sd card
    7) Compile the movie player program. This is a hybrid of Baggers' 256x96 video driver and Kye's SD driver. Normally the video driver runs all the frames and then stops, but for animated GIFs I just put in a "repeat" in spin and then loop through the frames (23 frames).

    The hardware is a dracblade but it is overkill for this application as you don't need external memory etc. Any propeller will do - in fact for this sort of program all you need are 4 pins for an sd card and 3 pins for a TV.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-08-02 03:59
    Thanks ever so much. I can continue to work on my own GIF animations in GIMP+GAP while I get up to speed on all this. But I must buy an SDcard slot to add to my Propeller to bring it all together. That will take a week or so for delivery.

    In other words, no rush - you've given me quite a bit to do.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-08-02 05:41
    Hmmmm.

    ImageMagick's 'convert' command allows me to transform a .GIF file into a .TVM file in one go. And there are added features to resize and clean up the image in a variety of ways.
    So I am left wondering whether this is a viable alternative conversion.

    I have also converted the .GIF to .BMP files as well - 20 in all. Your video converter seems nice. But as usual, if you search for a Windows app - someone sells you one. When you search for a Linux app, you often get just as good ported over to Windows for free.

    Either way, I can then view the .BMP or .TVM for futher manipulation and format verification with traditional Unix commands. I just don't exactly understand the technical goal (a .TVM file of a certain specification?)

    For anyone interested, here is a thread to download Baggers' 256x96 video driver http://forums.parallax.com/showthread.php?132909-Some-nice-aerial-shots-of-Sydney-Australia
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-08-02 06:56
    Two files attached.
    One is the spin player file - almost identical to the link in the post right above but with the filename changed and the repeat loop so it keeps looping
    The second is the vb.net program to process the files. I tend to run this from within vb.net rather than as the compiled program as I'm always changing things. unzip and if you have vb.net installed, double click "catalina.sln" and hopefully that will open the program.

    This 256x96 converter is in the "High Res TV" tab. Play around with single files first. Try altering the topx, topy and width variables. Sometimes the picture overlaps itself - that is a quirk of vb.net. Keep experimenting till it fills the screen the best.

    If you used AVS4YOU you end up with a series of bitmap pictures with numbers after them, eg loopy_01.bmp, loopy_02.bmp, so the bitmap root name is loopy_, and then you can add in the numbers. This automates the creating of the large movie file.

    This is all very experimental at the moment so please let me know if things don't work.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-08-02 08:16
    Thanks.

    I am also getting a series of .BMP files which are numbered with the ImageMagick 'Convert' function. I did notice that the .BMP files vary in size and the first one is the largest area. So it seems that the first one defines the height and width and the rest position themselves at the same corner. I assume that this is a storage saving scheme.

    I am still stuck without the SDcard slot, so it will take awhile before I can move ahead. Lots of study to do - your provided packages, ImageMagick, and Gimp+Gap.
Sign In or Register to comment.