Archive for April, 2010

Visualising Binary Strings

Friday, April 30th, 2010

Yesterday I met an interesting lady called Lisa doing her final year art degree project at Staffs Uni. Her project looks at the interaction between man and machine, I’m sure she could give you a nice, long explanation, but I’m not an art student ;) The reason I got involved was because I can knit! Lisa had taken a poem (Ode to the Framers of the Frame Bill) and converted it into binary. From there, she had converted it into knits & purls. We were all asked to sit in front of computers and follow the onscreen and spoken instructions, knitting and purling together, man following machine, introducing mistakes and the human element.

It was an interesting experience. I was one of very few who could keep up with the instructions, right up until I got a tangle in my yarn :( But I managed to play catchup and there was only half a row of random ;) The collection of final knitted pieces were a very interesting selection. I don’t think many of the knitters would have been employed by a knitting factoy ;) Or perhaps we just all needed slightly slower instructions and less tangly yarn? :D

We ended up chatting for quite a while afterwards, as Lisa was interested in other ways her string of binary could be used. We discussed ways of turning it into a picture of some sort… and so I lost my evening to playing with some C# code creating bitmaps in various ways from binary strings. So as not to spoil Lisa’s project, I will be demonstrating my crazy image creation with a different poem, If… by Rudyard Kipling. First, we need to turn that into a binary string, for which I used this translator as recommended by Google ;) So from words we get a binary string which starts like this: 01001001011001100010111000101110001011100000110100001010000011… :)

The first two images are fairly obvious… translate each digit into a pixel, with 0 = black and 1 = white or vice versa. Lisa wanted an image 64 pixels wide to match other pieces in her project. Obviously a multiple of 8 works better (there being 8 binary digits to each letter) but here I’ve chosen 128 to get a more square image. I’ve also zoomed in for you, so you can see the detail better :) (click on the images for even bigger versions!)

   

Next up, Cayden suggested using each 8 bit section as a colour, using that number as the RGB values to create a grey scale image. Here’s the result…

This naturally led onto using 3 characters per pixel to create a colour image from the text…

Next came one of my ideas… I had envisioned a tree, branching out from each side, a string of 0s creating a branch on the left, a string of 1s a branch on the right. Of course, there aren’t any particularly long strings of matching digits, so it wasn’t quite what I expected. I turned it sideways and it looks more like a bar graph now :) This is just a short section as the full text is over 6000 pixels wide, and that’s before I zoomed in to make it clearer ;)

Then I had an idea about it making a path, 0s going right, 1s going down. This created a nice, almost diagonal line, but that wasn’t very exciting. So instead, I limited it to a 64 pixel height, and reversed the direction of the 1s each time it hit the edge. This created fairly neat hills :) Again, this is shortened as the full text is very very long!

Then Bryan suggested that for a 0 you could turn left and take a step forward, and a 1 would turn you right and a step forward. I thought this would just end up with basically a circle… oh how wrong I was! Instead it created these beautiful maze/fractal/organic pictures…

Well, I couldn’t resist adding a little colour, first getting the colour to cycle black to white through all shades of grey, increasing the RGB value with each step…

Then using 0s to increase the red value, and 1s to increase the blue value, each resetting to zero once 255 was reached. I’ve also marked the start and end with a bright green dot! :)

So there you go… a number of ways to visualise a binary string taken from a poem. Of course, the text can be anything you like! A lot of time was spent last night parsing various things through the program and sharing crazy images :) Here’s the Declaration of Independence:

Should any of you be interested in playing with my program, here’s a nice little zip file of the latest version. It’s not very intuitive, it only displays a few of the images in the window, but does generate all of them (just look in the folder). It shouldn’t crash, but if it does, send me an email with the binary you used to crash it and I’ll look into fixing it :)

BinaryToImage

Oh, and in case you’re interested… here’s the source code ;)

Smile Inducing :o)

Monday, April 26th, 2010

Inspired by Attic24‘s “Three Things” posts, here are three things which made me smile over the past few days…



A big pile of DVDs purchased with an Amazon gift voucher my parents gave me for Easter.

There’s something of a Tim Burton theme, and for anyone interested the DVDs are: Edward Scissorhands, Beetlejuice, What’s Eating Gilbert Grape, Sleepy Hollow, Ed Wood and 9. Coraline also arrived a couple of days later :)


Baking cookies! :)

I love the spritz cookie maker I was given for Christmas, it’s so easy to make cookies with! :) This batch were just the classic recipe, decorated with some very sparkly “barbie glitter icing gels” I was also given as a present. Rupert, Bryan and I had great fun getting icing, silver balls, chocolate sprinkles, hundreds & thousands, glace cherries and the like everywhere :) They tasted pretty good too ;)


Watching my garden grow :)

Can you see all those little specs of green? In that photo there are radish, lettuce, leeks, purple and white sprouting broccoli, spring onion and carrot growing. No sign of the courgette or runner beans, but I’m not giving up on them yet :) The strawberry back left was a bit of cheating, since it was transplanted out of the middle of the gravel patch (no idea how it got there!) in the hopes of keeping it away from the ants so we can eat some this year.
Inside I have some flowers growing, and this morning I caught a first glimpse of green in the pepper tray! :) It’s all very exciting… if they would just grow a little bit faster, I want to eat them already! ;)

What has made you smile over the last few days? :)

Websites I Frequent

Wednesday, April 21st, 2010

For those of you reading this blog who haven’t signed up to be part of the beta testing, you might be thinking that I never post. I do… it’s just all hidden! ;) So I thought I should write some posts which everyone could see.

Today’s post is going to be about the websites I frequent and why I find myself spending time on them. Places you should maybe consider having a little look at to see if they might interest you too :)
In no particular order…

RavelryRavelry
If you are in any way knitting, crochet, weaving or other yarn related craft inclined, this is the site for you! This site eats up rather more of my day than I’d care to admit to, thanks to its HUGE pattern database which I browse for ideas, and the very chatty forums. There are people around to help when you can’t figure out a new technique, groups where you can chat about the latest episode of your favourite TV show (including ideas on how to create any knitted/crocheted items seen) and so much more. It helps me keep track of projects, tries to organise my stash (though I have more than I’d ever admit to!) and has a lovely community.

Attic24
Another craft related item, this time a blog. Lucy documents her life in beautiful, colourful photos. Her posts are almost always upbeat and cheery, full of random moments from her day, and never fail to make me smile. I love Lucy, and I bet you will too! :)

Camp Chemist
Following on the blogging theme, I have a friend from Stafford Concert Band who studies chemistry up at Keele Uni. He’s started writing a blog and I’m sure he’d love some more readers. His posts could do with a spell check ;) But he’s generally quite interesting, talking about chemistry, astronomy, and his days.

Stafford Concert BandStafford Concert Band
Since I mentioned them, I thought I would add a linky to their Facebook page. I would link to their site, but it’s updated even less often. I’ve been playing with them for a few years now and have just been “promoted” to first clarinet (i.e. none of our current first clarinettists can make it to some of the concerts this year!) We play at quite a lot of fetes during the summer, and are always looking for new members! :)

Paper or Plastic?
Some of you may remember Astragali from the Astraware beta forums, but I don’t know how many of you will know he writes a web comic. The art might not be stunning (but then xkcd is just stick men) but the comic always makes me laugh :)

Walker Tracker
With the current trend for everyone to feel a need to get fitter, I’ve found one good way to keep myself moving is by wearing a pedometer. Walker Tracker gives you somewhere to write down your daily steps, provides nice little graphs, and has a competition area to keep you motivated.

Conceptis PuzzlesConceptis Puzzles
A site full of lovely Japanese logic puzzles to steal away your free time. I love the ones which make pictures in particular. They have a free one in each section every week, and more if you’re willing to pay.

Hopefully one or more of those links got clicked, and I showed you something new :) Just don’t blame me if you spend the rest of today reading the Ravelry forums, playing logic puzzles, or reading comic/blog archives! ;)