jp2a

I’m going to write about jp2a, a Linux utility that converts jpg images to ascii.  The problem is that my blog posts (when they happen) usually aren’t purely about technical topic.  I like to ramble on about random things.  So, I’m going to do that a bit and then talk about jp2a.

Oh, I thought of something: I’m eating a Banquet for lunch right now.  Boneless Pork Rib to be exact.  I noticed that after cooking it (haha, I mean heating) some of the sauce was still on the cellophane so I scraped it off with a fork so as to not miss that saucy-awesomeness.  I’m glad I did that.

Alright, I feel I have rambled enough, now on to jp2a.

If you didn’t get it already, jp2a stands for “jpg to ascii”.  They are hip and use ‘2′ to mean ‘to’.  Clever.

I wanted to email a picture of myself to my dad for possible use in a Christmas card he is going to make.  The problem was that I didn’t have the picture on my computer at the time.  I did have it on my server at home, though, so at least I could scp (transfer it via the intertubez) it to myself.  After finding the folder that the picture was in, I then had the problem of not knowing which picture of the thirty or so it was.  The folder was logically labeled, so that was good, but the actual images were just the standard IMG_[number].

Yet another roadblock was that my server doesn’t run a GUI, it is command-line only.  (Note how I’m not labeling that a “problem”, I prefer the challenge and awesomeness of a GUI-less server.)  That means that I couldn’t look at the image files without first transferring them to my computer.  That would take a while as [1] I’d have to transfer over the entire set of pictures and [2] the upload speed at my apartment isn’t stellar.

I decided to do some research and see if there was a utility that could produce an ASCII “art” representation of my images.  That would allow me to get a basic idea of what is in the image and I could do it all remotely.  Turns out there is and it’s called jp2a.

Using jp2a is pretty easy.  It includes a handy flag that will output the image in color on your terminal.  I’d almost say that a utility like this would be quite useless for what I’m doing with it here if one couldn’t output the ASCII in color.  One requirement is that the image is a jpg as it won’t work for other image formats.  (Once can use imagemagick and a pipe if they have to work with a non-jpg.)

So, quite simply, to run jp2a one types:

jp2a --color [image name]

Now for some examples.  Here is the picture that I was looking for:

that's me!

This is what it looks like when jp2a is ran on it:

that's me in gigabitz

As you can see, it does a pretty decent job of representing what the image looks like!

One last thing: I had to run this command on all the pictures in the folder.  jp2a doesn’t label the image when it prints out, so using * as the input value isn’t too helpful because you don’t know what the name of the file is that is being displayed.  I found and edited a quick bash script to output the name before the picture as well as run jp2a on all jpg files in the current directory:

#!/bin/bash
for file in `dir -d *JPG` ; do
    echo $file
    /usr/bin/jp2a "$file" --colors --width=100
done

Yeah, yeah, it could be more advanced, but it did what I want.

So there you have it.  A blog post and an informative one at that.  Plus, you got to see my pretty face, always a plus.

No Comments »

william on December 17th 2009 in Banquet, Puters

bed logging

I believe I have come up with something revolutionary: logging from bed. (via my touch currently) I shall contract the words to give it a shorter name to help ease adoption and encourage common usage: blogging.

Blast!

No Comments »

william on April 10th 2009 in Uncategorized

fantasy names – formerly ‘ah crap’

So I was just writing a blog post complaining about names in fantasy novels.  I was even making up my own names for a book that I would like to write if I ever had so much free time that I felt like writing a book.  Problem is, my plan is to have all my characters have names that are just letters I randomly hit on my keyboard.  I was typing examples and accidentally hit ctrl+w…that is not cool.  I’m really good at losing my blog posts mid-completion.

I will continue with my original thought/post all from memory:

Fantasy names in novels are dumb.  They have too many apostrophes and are too hard to pronounce.  The author probably practices pronouncing the character names while looking in the mirror in their bathroom so as to find something that makes their mouth move in some super-awesome (translation: dumb) way.  

In my novel, my characters would go something like: Aldsgq3og’3′lkd as the heroine squaring off against her new mortal enemy 433l””asljgaw’jgad’ljv Hrestgr<Windows Key>.  Note the apostrophes, those are paramount.  Also note how numbers are incorporated into the names.  Unlike letters, numbers can’t be capitalized.  Not sure where I was going with that…mainly it’s OK to have a number be the first character of a name.  As you can also see, “<Windows Key>” is actually part of the antagonist’s name.  That is because I hit the Windows Key as I was creating his name.  Clever, eh?  

I will further improve upon my awesome novel by making sure the characters change their names at least once in the story.  Keep my readers on their toes.  I would probably have 33l””asljgaw’jgad’ljv Hrestgr<Windows Key> (copied and pasted, had to) change his name to something including “<Left Meta>” because he just discovered Linux and wanted to make a keyboard shortcut to do something and <Windows Key> isn’t used.  Yeah, that doesn’t really make sense to change a name to reflect one’s want to have a keyboard shortcut, but it’s my novel, so I can do whatever the hell I want.

Also, my novel will take place in the past/future.  Yup, the past/future.  It doesn’t make sense, does it?  Well, neither does sound in space, but it is awesome, so it’s cool.  Also, if you couldn’t tell, my novel would be a satire on other fantasy novels.

(Can I make an hr?)


Nice.


I should write more blog posts at late hours when I’m kind of delirious.

I think I’m going to try and make my titles all lower case.  Let’s see how much it messes with my bad grammar-thing tick.

No Comments »

william on April 10th 2009 in Idle Ramblings

Tertiary

From my touch.

No Comments »

william on March 7th 2009 in Uncategorized

Second

blargh

1 Comment »

william on March 7th 2009 in Uncategorized

First Post

First!

No Comments »

william on March 7th 2009 in Uncategorized