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!

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?

Threading Bullets

106-bullets-8

A the end (or endless end) of the headless ds106 course, Mariana published a wonderful reflection on her tumblr DS106 in 106 posts and 106 bullets published at 1:06.

Mariana and I have been musing on a collaborative project based on the list. As she commented on her own post:

* An exclusive Radio Show planned to unpack the ideas ‘Golden DS106 bullets’ with guests in the hot seat and in conversation with the hosts (surprise for #DS106Radio next year)

Being connected to DS106 the first thing to do is to make some art, Paul has already started 106 Bullets, and I started playing this weekend. I had commented on the post:

This is just brilliant. 106 prayer beads. You have brought depth to headless ds106. These bullets would be great as a initial reading for ds106 or as a series of meditations during a round.

So I am riffing on beads & bullets, mantras & koans. The image at the top came is a wee photoshop experiment, I spent some time googling on how to wrap an image round a cylinder, after a tour of some that used the 3D menu I settled on warping a layer following: Warp Tool Effect – Photoshop Tutorials – CSSCreme.com.
ds106-bullet
I am afraid I still find Fireworks easier to use so imported this image it Fireworks for the duplication. I am now managing to use photoshop for selection as the tools are a lot better than Fireworks. (I am of course barely scratching the surface of photoshop’s power).

Next I started thinking of bumpers, still on bullets and messed about with Garageband a wee bit:

Using Freesound.org – “Gunshot2.wav” by alukahn.

I was still wondering about the 3D tools in photoshop so started playing. I found I could make a bead from the DS106 Skull and Crossbones:
lots-of-D106-bead-small
This was really easy, I make a 2×2 grid of the image grouped and then from the 3D menu choose New Shape from Layer -> Sphere I had one bead. I then duplicated it and rotated it with the tools from the 3D palette so I had half a dozen beads. This opened in Fireworks for some duplication.

I posted these images to the DS106 google plus group and got some interesting feedback: John Johnston – Google+ – pile of ds106 beads. Almost enjoying a little photoshop,…
Some of this was a distaste for bullets and skulls. I understand this, especially the bullets, I’ve giffed a few gunshots out of movies but it can feel a bit odd. (I do like thrillers and movies with guns though). I am happy to live somewhere where guns are mostly contained in fiction. With the Skull and crossbones I am a lot more relaxed, thinking of romantic piracy. Interesting to keep these thoughs need the surface and not get carried away. Hopefully the flowers, if not the skulls, will indicate that my bullets are peaceful and metaphorical puns.

Finally I though it might be nice to animate the beads:

beads_01

This was the first pass. I am using my old friend SuperCard, a mac scripting application. I made 6 graphics, one for each of the different beads, these were duplicated until I had 106 beads on the ‘card’.
SuperCard makes it easy to manipulate object. I wrote a script to put each graphic on a random space on the card. Another change the size of the beads at random. Finally one to move each bead a small random amount and dump an image of the card to the disk. Looping through that a few times gave me a set of jpegs. There were taken into fireworks to be distributed to frames and exported as an animated gif.
As an example of how simple SuperCard is, here is the script to randomly move a graphic:

on randomMove n
get the loc of bg grc n
add random(60)-30 to item 1 of it
add random(60)-30 to item 2 of it
set the loc of bg grc n to it
end randomMove

Almost english!
I am thinking of changing this a bit, to roll the beads around and change their postion front to back, I might get some interesting gifs from this.