I thought it might be worth noting this use of claide.ai. I’ve seen a wide variety of views on AI and its promise & pitfalls. When it comes to writing a wee bit of code I feel a lot of sympathy with Alan’s approach. But I have dabbled a bit and do so again this week.

I use gifsicle a bit for creating and editing gifs, it is a really powerful tool. I think I’ve a reasonable but limited understanding of how to use it. In the past I’ve used it for removing every second frame of the gif and adjusting the delay.

#!/bin/bash gifsicle -U -d 28 --colors 64 "$1" `seq -f "#%g" 0 2 20` -O3 -o "$2"

This is pretty crude and you need to manually edit the number of frames and guesstimate the new delay which will be applied to every frame1.

I know gifsicle can list the delays of each frame with the –info switch, but I do not know enough enough bash to use that information to create a new gif. I had a good idea of the pseudo code needed but I reckoned that the time it would take to read the man page and google my way to the bash syntax needed was too much for me.

This week I was trying to reduce a gif I’d made from a screen recording. It turned out a bit bigger than I had hoped. I tried a couple of application but didn’t make much of a dent. I decided to ask Claude:

I am using gifsicle/ I want to input a gif, and create a new one. Explode the gif, delete ever second frame and put an animated gif back together doubling the delay for each frame. So a gif with 20 frames will end up with 10 frames but take the same length of time. I’d like to deal with gifs that have different delays on different frames. So for example frame 1 and 2 the delays for these frames added together and applied to frame one of the new gif.

The original query had a few typos and spelling mistakes but Claude didn’t mind. After one wrong move, when Claude expected the gifsicle file name to be slightly different I got a working script and took my 957KB gif down to 352KB, that was the image at the top of the pos2t.

I had asked for the script to use gifsicle explode facility to export all of the frames. Which the script did, neatly in a temporary folder. As I typed up this post, looking at my original attempt, I realised I should not have asked for the script to explode the gif, but just grab every second frame from the original. This seemed more logical and perhaps economical, so I asked Claude to take that approach. The final script has been quickly tested and uploaded a gist: gif frame reduction in case anyone would find this useful.

Of course this has added to the pile of not quite formed reflections on AI and should we have anything to do with it. I don’t feel too guilty as I needed at least a little gifsicle knowhow to get started.

  1. The seq command just outputs a sequence of numbers from 0 to 20, counting up in steps of 2. The -f “#%g” makes it print a # before each number, which makes gifsicle understand it as a frame selection instead of a file name. The backticks around the seq command cause its output to be included as parameters in the gifsicle command line. I am sure I googled to work that out ↩︎
  2. There is a difference between the sizes reported by the Finder & WordPress. The wordPress ones are on the image caption. ↩︎

gifsicle -U original.gif "#0--2" -d200 "#-1" -O2 > with-delay.gif

This is useful, I am making quite a lot of gifs for Glow Blogs help at the moment. Current workflow: export from screenflow as a mp4, Gif Brewery to create a gif and then this to add a bit of a delay and reduce file size. There is a nice explanation of the parameters.

I was interested to read How to Reverse an Animated GIF

convert water-forward.gif -coalesce -reverse -quiet -layers OptimizePlus -loop 0 water-reversed.gif

So gave it a quick try.  The result wa fine, but my 228kb gif was 1.1 MB in reverse. So I had a wee look art the gifsicle man page and ended up after a few tries with:

gifsicle -U stairs01.gif "#-1-0" --colors 32 -O3 -o downstairsR.gif

249kb

animated gif from black and white film reversed so woman appears to walk down the stairs
I can’t recall when I made the original gif and which film I took it from.

(@BryanMMathers)

points to his blog post The way of the remix.

Where he asks:

Do you remix?
If so, how do you remix? What is your remix trigger? Is it curiosity or simply joining the dots as you see them? Do you like to layer-up? Or strive to simplify? Is it a tickly thought? Or a random one from left field?

Well yes, I think I do, although my definition of remix might be widened to include mashup. but of course, Everything is a Remix.

How, is a long story. I guess I prefer DIY approaches. I use baby steps, image editors (Fireworks is my fav), JavaScript, php, commandline tools (ffmpeg, imagemagick, gifsicle) and anything else that seems interesting.

The why is harder, I am not a developer or an artist, I don’t make anything as polished as the remixes that scale on social media. I like to think it is because I nearly can. That is I am going to learn something in the process.

DS106 was a major trigger, the people involved, especially @cogdog, @jimgroom and @mvdfunes The daily creates from DS106 often led to remixing.

Wouldn’t it be cool is another trigger, or I wonder, or will it be funny, or impress someone(Usually only me). Or I learn about a new, to me technology and try it out.

Here are a selection remixes & mashups I am quite please with:

Featured image, a remix of a gif that I made as a remix of an image in the Tate. using The way of the remix by @bryanMMathers is licenced under CC-BY-ND.