Saturday, December 30, 2017

Convert Large GIFs to Video


For GIFs under 100 MB, there are plenty of free tools around like Convertio that will convert GIF animations to AVI, MPEG, etc. But I'm not talking about HD reaction memes here. I'm helping to process full on NOAA AWIPS radar graphics. The following example is 2015 x 1224 px, and 300 frames long. These GIFs range from 97 to 170 MB, so the free online tools aren't going to cut it right now.

I'll do this manually with:
  • GIMP: A free, open source alternative to Photoshop
  • A GIMP plugin called Export Layers
  • Sony Vegas, or any other video editing platform - even Windows Movie Maker

Download & Install the Plugin

  • Download and install GIMP
  • Download the Export Layers plugin (zipped)
  • Copy the export_layers folder and the export_layers.py Python script file to your home directory:

    My Plug-Ins directory is: C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins but you may need to do some sleuthing depending on your installation, version, etc. If so:
    •  Go to Edit > Preferences
    • Expand the Folders group
    • Select the Plug-Ins preferences to view the Plug-Ins folder locations
    • Copy the folder listed along with your software installation location
  • Open GIMP (or restart GIMP) and check the File menu for the new Export Layers options

Open a GIF in GIMP

File > Open will load a GIF frame by frame as separate layers, in descending order. The first frame of the animation will be at the bottom, and the last frame will be located up at the top. Conveniently, the layers are automatically named with a frame position, and a frame duration in parentheses. These are helpful in case any frames (especially the first or last frames) are longer than the rest of the frames in the animation.

Export Layers

Now that the Export Layers plug-in is installed, you can immediately export the loaded GIF layers as individual frames.
  • Create a new directory to organize these frames separately since it'll only be a temporary intermediate set of files
  • Back in gimp choose File > Export Layers
  • Now simply choose the new directory that was just created to store these exports. Accept all default settings, and click Export Layers then Export to process the exports

Load Frames in Video Editing Software

  • Open your preferred video editing software
  • Find the preferences section that handles the default duration of still frames. Set this value to match the general frame rate of the GIF. In the screenshot above, most frames are 50 ms, while only the first and last frame of the animation hang a bit longer to denote the beginning and ending of the radar loop.

    In Sony Vegas:
    • Options > Preferences
    • Editing tab
    • Set New still image length (seconds) to 0.05 seconds (50 ms)
    In Windows Movie Maker:
    • Load all individual frames
    • Select all frames (Ctrl+A)
    • Navigate to the Edit tab
    • Set the Duration to 0.05 seconds
  • In Vegas, now Import the frames which will have the duration set by default
  • Next, select the first frame and expand it or manually set the Duration value for that individual frame to match the duration listed in its file name. In this example, the first frame hangs for 700 ms (0.7 seconds)
  • Repeat this step for the last frame in the animation: 1500 ms (1.5 seconds)

Export

  • Export and share as you need

Tuesday, May 9, 2017

Quick Emoji on Desktop

! When this was first published, Facebook and other apps did not have desktop emoji support. Even now, it's a bit clunky and cramped so this post might still be helpful

I love using emojis on mobile. It's childish, but I entertain myself by posting eleven cry-laughing faces in a row; or any insane flood of emotional responses and random items. I find that it adds a bit of dimension to plain raw text without having to find the exact rage comic or photo to accompany a quick message.

Even my wife sends entire emoticon shopping lists.



On desktop, however, it's annoying to have to Google a set of icons to use for just a casual Facebook interaction. Using Chrome, I created a bookmark and made a short keyword to quickly launch a preferred page of symbols.

Link a Page to a Keyword

I've been using this set of "facebook symbols" because its layout is decent, the emoji organization is similar to my Android, and it automatically copies single selections and it can copy an entire string of emoticons. Something like Emojipedia is not as rapid-user friendly.
  • Navigate to Chrome Settings (chrome://settings)
  • Scroll down to the Search category and click Manage Search Engines
  • Scroll to the bottom the lower box (Other search engines
  • Type a page title in the Add a new search engine box. Something like Facebook Emojis will do
  • Pick a short keyword to launch the page. For my Facebook Emojis page, I entered fbe here
  • Finally, paste the URL of the page in the last textbox
  • Click Done and close Chrome Settings
Now simply open a new tab (Ctrl+T) and type your keyword to launch the page.

Tuesday, April 25, 2017

Setup Arduino Print Line / Debug Print / Console Log Messaging

It took me a few extra minutes to figure out why any Serial.println() statements weren't appearing in my Arduino IDE's Serial Monitor. I'm brand new to Arduino coding, but it seemed like if you click the Serial Monitor icon your debug/print line messages should show up there.

For this basic example, I set the Arduino Uno's onboard LED on Pin 13 to blink twice per second, with a println() statement running just after each change of the LED's state. Esssentially:

  • Turn on the LED
  • Write me a message that says On
  • Turn it off
  • Write Off
  • Etc.


It turns out that I needed to set the channel to communicate with the IDE in code.

Inside void setup(){} add the line Serial.begin(9600); where the value 9600 matches the baud rate in the Serial Monitor.






That's it. It begins writing to the monitor as soon as you upload the sketch and the device resets itself.

There's some more information about the begin() method on the Arduino Language Reference