A while back I did the daily create for 6 January 2014 Create a Self Portrait Cubomania Style. And knowced up a couple of quick web pages to make cubomania images and gif.
The other day I was messing about with some web pages inspired by the Universe app and was reminded of the cubomania stuff.
I’ve updated the Cubomania Gif! page so that you can, choose the number of slices, speed of the gif and the ability to add a frame of the original image. You can also make static jpg versions on the same page.
I am attracted to the random nature of cubomania, interestingly if you search for images online many look as if they have been rearranged with some taste as opposed to randomly.
Featured image on this post was from a tweet by Theo created with the webpage.
— Theo Kuechel (@TheoKL) October 17, 2016
One more, this time including the original
Prerequisites: ffmpeg, imagemagick, gifsicle, I’ve installed all of these commandline apps via Homebrew.
Cartoon Fred’s ImageMagick Scripts: CARTOON.
I downloaded this then made it executable using the terminal:
chmode +x cartoon
I then moved in into /usr/local/bin/
the proper way is probably
mv cartoon /usr/local/bin/
but I did
open /usr/local/bin/ which open the folder in the finder and dragged the file across.
I ned a movie so:
Which I downloaded with YouTube downloader tool – Fastesttube!.
I copied the download into a folder and renamed it dancer.mp4
In the terminal I move into the folder by typing cd and dragging the folder int the window and pressing return.
I then made a new folder
I switched to the finder and previewed the movie to find out where I want to start extracting frames, which turns out to be at 26 seconds, and I want to get 3 seconds worth at 6 frames per second:
ffmpeg -ss 00:00:26.000 -i dance.mp4 -t 00:00:03.000 -r 6 jpg2/dance_%04d.jpg
This give me 18 jpgs in a folder.
I move int othat folder and make a new one:
I then use cartoon to make a cartoon image for each jpg in the toon folder:
for i in *.jpg; do cartoon $i toon/$i;done
(cartoon uses imagemagick)
This takes a wee while, I then make yet another folder:
and convert all the cartoon jpgs into gifs:
for i in *.jpg; do convert $i gifs/$i.gif;done
(convert is part of imagemagick)
Finally I make a gif
gifsicle --delay 12 gifs/*.gif --loopcount -O3 --colors 16 -o ../../dance.gif
You can see the gif ends up in the top folder. There is a 12/100 of a second delay, it loops forever, is reduced to 16 colors and optimised (O3).
Along the way there are a lot of other possibilities, convert for example can adjust the brightness and contrast (and a raft of other things). I brightened these ones up a bit:
In reaction to
— Jim Groom (@jimgroom) July 14, 2016
Like the cartooning of videos a couple of posts ago there is the opportunity to see and understand a bit more about film using this technique. Jim might be thinking that (says Alan) but so far I am just having fun.
It started with a tweet:
— Jim Groom (@jimgroom) April 22, 2016
Then Alan: Spinning Albums from Reclaim Records made this:
Which was asking for a gif:
This was a little quick and dirty, it used my original Dancing Jim from ds106 Assignments: Dancing Jim all over the world. I knocked it up just before bed time last night.
- Download video (I use YouTube downloader tool – Fastesttube!)
- Export some frames with MPEGStreanClip
- Import into fireworks, as layers and distribute to frames.
- Import gif 3 times an 1st, 10th and 19th frame
- Export to gif, bit of loss 256 colours
This morning I remembered a cleaned up version of the gif: August 2013 GIF Challenge #2: Dancing Jim All Over the World | I am Talky Tina and a tip to clean up further: He’s a Maniac! And He’s Dancing Like He’s Never Danced Before | de•tri•tus.
I grabbed that and:
Finally I though to add some music:
Having downloaded Minutemen – I Felt Like a Gringo from YouTube and pulled out a bit of audio, crushing to 32bps, with audacity.
GifMovie with my GifMovie Plugin.
If you can’t tell I love the connections in this #DS106 story.
One should always be drunk. That’s all that matters…But with what? With wine, with poetry, or with virtue, as you chose. But get drunk.
― Charles Baudelaire
I find gifs intoxicating, not the looking at them but creating. This is ridiculous. I find sitting down to rip a gif out of a movie and crush it to as small as possible, or to script some sort of weird concoction a lot of fun.
This morning I read Alan’s post: Ooh Ooh Mr Kotter! I Know How To Optimize My GIFs!. It is great, a reminder than some of the fun of giffing is keeping the file size down.
I though that I would se if I could replicate the sort of optimisation he writes about using gifsicle, for a wee bit of fun and learning. I’ve blogged about gifsicle a fair bit here. Gifsicle is a commandline application for working with gifs. It can be downloaded from Gifsicle: Command-Line Animated GIFs.
I stared by a sort of replication Alan’s use of GIPHY’s GIF Maker. I took:
and fed it through the giffy tool.
Like Alan I ended up with a huge gif 4.5MB worth.
So I downloaded it and got some info about it with gifsicle on the commandline:
There were a good few more lines, but I got the idea that there were 45 frames, each about 0.07 seconds long.
The plan was to reduce the colours, the number of frames and increase the length of frames to compensate.
The first thing I tried was:
gifsicle -U -O3 -d 28 --colors 128 drunk.gif `seq -f "#%g" 0 4 45` -o drunk-128.gif
What this does
-U: unoptimises the input gif
-O3: optimises the output
-d 28: set the delay to 28/100 sec
- colors 128: cuts down the number of colours
seq -f "#%g" 0 4 45 is a clever bit:-) it produces a sequence of numbers with # in front between 0 & 45 in jumps of four. This causes gifsicle to use those frames of the original gif. We have reduced the number of frames and increased their length to keep the animation the same length.
This resulted in a 1.1MB file, not too good. I repeated the exercise with 64 colors, which got the gif down to 800kb
Not too bad but still a bit big. I then remembered there was a version of gifsicle that could do lossy production of gifs. Alan mentions using this in photoshop. I had downloaded this before but lot it. A qick google found this interesting post: Lossy Optimization for Animated GIFs – Rigor and lead to Lossy GIF compressor where I downloaded the modified version again.
I could now:
gifsicle -O3 --lossy=80 -U -d 28 --colors 128 drunk.gif `seq -f "#%g" 0 4 45` -o drunk-lossy-128.gif
Which give me, a 480k gif:
gifsicle -O3 --lossy=80 -U -d 28 --colors 64 drunk.gif `seq -f "#%g" 0 4 45` -o drunk-lossy-64.gif reduces the colours and weighs in at 391k (from the original 4.5MB).
I decided to push the lossyness a bit to:
gifsicle -O3 --lossy=160 -U -d 28 --colors 64 drunk.gif `seq -f "#%g" 0 4 45` -o drunk-lossy-160-colors-64.gif
This only shave the gif down to 325K so I think lossy=80 seems a good compromise.