Gif Scraping and a DS106 Gif API

It started, as so many things do, with a tweet(bark?) from CogDog linking to The Best of ds106 GIF TV. This got me thinking of how to automate the gathering of gifs. I remembered that I had done some gif scraping a while back: Doug’s Gifs.

I wondered about scrapping tumblr in the same manner with a wee bit of php. This turns out to be quite simple: Gifs, Gifs


$url = "http://jjgifs.tumblr.com/rss";

$rss = file_get_contents($url);
$matches = array();
preg_match_all('!http://[^?#\s]+\.(gif)!', $rss,$matches);

I didn’t do the regExpression myself, I must have found it on the internet when I made the page of Doug’s gifs. Anyway at this point you have a list (php array) of urls to all of the gifs on the page. I’ve not worked out the best way to handle this, but currently I am writing it to a cache file and only updating it every now and again. The list is put into a JavaScript Array.

The page Gifs, Gifs, loops through a few ds106naughts tumblrs rather than just the one. It then displays a random gif, clicking on this will display another.

This is pretty much proof of concept rather than a well though out solution, but it works. There are a few interesting things that could be done structurally. Alan has already suggested hiving off the generation to a separate php file and a cron job. We could then have a plain html/javascript page for display. He also suggest a next and previous button(√). I am guessing that it might be better to have the list in a database?

Now I have a text file with a list of ds106 gifs, it is pretty simple to have a
ds106GifAPI! This following image should be a random DS106 gif:

a random ds106 gif

The code used:


<img src="http://johnjohnston.info/oddsandends/ds106gif" alt="a random ds106 gif " />

This should give a random gif every time.

THe DS106 Gif API

Imagine you are blogging (or making any webpage) and want an exciting gif to go with your post, but you don’t just want any old gif, you want a random DS106 gif. Safe for work but not for your mind. Now you casn, simply use http://johnjohnston.info/oddsandends/ds106gif as an image url and you will get a random gif every time the page loads.

Given that my gif store is a list of gif urls the code is simple:


<?php
$cachefile = "Path/To/The/Cache/File.txt";
$gifs = file_get_contents($cachefile); 
$gifArray=explode("\n",$gifs);
$thisgif=$gifArray[rand(0,count($gifArray))];
header('Location: '.$thisgif);
?>

DS106 Random Gif API

Faster, Faster, Gif, Gif

I’ve been having quite a lot of fun with animated gifs recently. Mariana Funes @mdvfunes posted a method developed by Michael B Smith for making gifs from fast cut bit of video.

Mariana’s post: The Altered State Gif Technique gives the details.

I’ve been doing some experimenting around this. First I just googled fast cut examples to get a couple of pointers, Requiem for a Dream fitted the bill. I’ve not seen the movie, but:

Aronofsky uses montages of extremely short shots throughout the film (sometimes termed a hip hop montage). While an average 100-minute film has 600 to 700 cuts, Requiem features more than 2,000.

Whenever the characters use street drugs, a rapid succession of images illustrates their transition from sobriety to intoxication. In this scene, Harry and Tyrone deal drugs and Marion uses cocaine while she designs clothes. The speed of the footage and the cuts alternates as the characters become intoxicated and sober.

Made this a good choice.

I was particularly interested in Michael’s idea of using a very few colours, without dithering, this both reduces the file size and helped ensure

the results were surprising and visually interesting

Rather than giving high fidelity.

Using the Requiem trailer from youtube, I sliced out a quick gif. I then experimented with the number of colours when exporting: requiem gif tests. By the time I had hit 16 colours the give was quite dull, brown being the main colour:

At that point I recalled editing the colours on the Firework, optimise palette by hand before, and gave it a go, this resulted in the gif at the top. I think that reflects some of the movies concerns, drugs, and hallucinations quite nicely. I’ve also styled the gif to be a bit wider than it is here which give even more of a pixalated effect which does no harm.

A nice contrast to the ds106 Assignments: Say It Like the Peanut Butter perhaps where:

Make an animated gif from your favorite/least favorite movie capturing the essence of a key scene. Make sure the movement is minimal but essential.

I guess I should submit it.

Finally I made a few psycho gifs using a variation of the idea, slightly tinting and changing the speed for a few gifs, this happened to be the 106th post on my gif tumblr!

Exploring the territory

Yesterday’s Daily Create looked interesting:

Exploration video. Maybe you’re exploring a new land, the depths of quarks, outer space, the mind, the soul, etc.

Given the excessive rain, I started thinking about exploring the mind, vaguely thinking of some sort of psychedelic movie, or even La Belle et la Bête which I’ve grabbed more than one gif from.
I don’t really have the toolkit or skills for skewing some sort of kaleidoscope, tunnel nightmare vision but I remembered I’d used Screenflow to do something like this with titles in my BRIGADS106 movie. and though I could do a little testing.
Screenflow is designed for screen-casting, but it lets you layer video (from its builtin screen-capture and elsewhere), text, and images. It allows you to zoom, arrange, rotate and transition to and from these effect on a layer-by-layer basis.
My first idea was a journey through a dark tunnel/gallery with animated gifs lining the wall. As I started experimenting I realised that this was probably doable, but not by me in an afternoon. I pivoted to do a journey into ds106 as a slightly wizzy screencast using some of screenflow’s effects, even this took most of the afternoon to complete.
In ScreenFlow you can add a ‘video action’ to a clip. After adding this you can set the zoom, rotation etc of the clip before and after the action, Screenflow will tween between the two.
Here is a screenshot showing a clip with a video action (click for full-sized):

Screenshot 2014-02-09 13.42.43

And a gif taken from the exported video.

journey_into_ds106_01

Interestingly you can use gifs in screenflow, I guess they are played via Quicktime, but unfortunately they do not loop. You can get round this by recording the gifs in screenflow. As I’ve been writing this up, I made a very quick experement.

  1. Made a webpage with a few gifs on it.
  2. Recorded the page with screenflow.
  3. In screenflow cropped to a strip.
  4. Imported into screenflow and made a movie rotating the first clip.

To make this work properly I’d need to think a good bit more about angles and timings, but I think there are some possibilities for fun.

But is Gif Art?

watts-the-minotaur

I’ve come across a couple of interesting projects this week involving animated gifs.
1840s GIF party: call for submissions | Tate and
The GIF the Portrait Project.

So far I’ve giffed a few images from the the Take 1840 exhibition. I then to find animating gifs as an end in itself, it is interesting that the both these projects seem to be thinking them as art.(there are some amazing examples at Tate Collectives tumblr).

I’ve also been reading The Academic GIF where Jim Groom is talking about how to:

integrate animated GIFs into a curriculum centred around film analysis.

The Tate challenge has become a ds106 Assignment, which already has some submissions, Tom Woodward producing beautifully subtle and a much more dramatic version of the same painting. Alan Levine puts both subtlety and humour in the same gif.

GIF FIGHT!! has a Special 1840 Edition which is filling up.

For the tate gifs I’ve changed tactics a little. I’ve been using photoshop to split the images into layers before switching to Fireworks for animation. Photoshop has superior selection tools.

I an unsure if anything I’ve done is Art but it is interesting in lots of different ways, from visual puns and jokes through problem solving. I wonder if gifs could become part of an arts curriculum in schools?