WordCram Release 0.2

The 0.2 Release has some nice changes over 0.1: it’s easier to use, it’s a bit faster, and the layouts should look better.

The details:

  • Words should stop running off the edge of the screen.  We can make this better, and we will, and soon, but it’s there now.
  • WordCram will sort your Words, and scale their weights for you.  If you’re  using the TextSplitter, this doesn’t affect you.  But if you’ve been passing in your own array of Words, taking care to sort them, and making sure the biggest word had a weight of 1, you can take a break, because WordCram will take over from here.  Give your Words whatever weights you want, and it’ll figure out how big they are, relative to each other.
  • Two minor API changes:
    • WordCram.draw() is now WordCram.drawAll(), to make it clear that it’ll draw ALL the words — which could take some time.
    • The signature for WordPlacer.place() has changed.  Where it used to take int imageSize and PGraphics host, it now takes int imageWidth, int imageHeight and int fieldWidth, int fieldHeight.  Hopefully this makes it easier to write your own WordPlacers.
  • Down in the guts, WordCram is rendering with java.awt.Shapes.  This matters because it makes it easier to keep words on-screen, easier to place them where you want, and eventually, easier and faster to re-color and re-layout a WordCram.

Add in a few performance boosts and bug fixes, and you’ve got a new release.  Check it out, play with it, and let me know what you think.  There’s still tons to do, if you’d like to help out.

This entry was posted in release. Bookmark the permalink.

5 Responses to WordCram Release 0.2

  1. David says:

    It looks great! Thank you for making it available.

    There are a couple of things I’d like to do with it. First, send the output to a hi-res image file. I tried using the Processing PDF library but I didn’t succeed (I’m new to Processing so it could well be lack of knowledge on my part).

    Second, I’d like to produce a word cloud bounded by an arbitrary shape (not a rectangle, in other words). What would you say my chances are of doing that using your extension hooks?

    Thank you again. I’m looking forward to future releases.

  2. Hi-res wordcrams should work fine, though they may be slow — I just made this 10000×10000 swirl one, and it took 108 seconds:

    import wordcram.*;
    import wordcram.text.*;

    size(10000, 10000);

    WordCram wc = new WordCram(this,
    new TextSplitter(StopWords.ENGLISH + " shall")
    Fonters.pickFrom(createFont("serif", 1)),
    Sizers.byWeight(100, 1200),

    long start = System.currentTimeMillis();
    long duration = System.currentTimeMillis() - start;
    println("took " + (duration/1000f) + " seconds");


    Arbitrary shapes, something like http://www.tagxedo.com/, is one of my eventual goals for WordCram, but I’m not 100% sure how to do it, and I’ve been focusing on speed and ease-of-use for WordCram first, so I haven’t thought it through yet. I’m hoping a custom WordPlacer would be enough, but there might be engine changes needed, too. If you try it out, I’ll help out as much as I can, and I’d love to see how it goes.

  3. David says:

    Thank you for the file output tip. I just tried that – works a charm.

    I have an idea that looks nice in my head but we’ll see if it still looks that way when I actually generate it. I have a large data file to assemble first so it will take me some time to get to that point. I’ll let you know how it goes.

  4. I looked at Tagxedo, and I think I might suggest an approach to producing similar functionality:

    Apply a convolution (or similar) edge-detection algorithm to pull out the lines and edge features of the image.
    Identify closed boundaries.
    Fill the closed boundaries with the words, in descending order by size with the largest word in the cloud sized to fit in the largest closed area.

    I also wonder if the words are being laid out along feature lines in the processed image to provide the illusion of a better match to the features of the underlying image. In fact, that may simplify things further, as words laid out along feature lines may avoid the need to identify closed boundaries.

    Just a thought.

  5. Brendon,

    Thanks. I’ve done some naive edge-detection on other mini-projects, but nothing serious. This could be a good approach, I’ll have to try it out. I was actually able to hack this feature into WordCram using only a custom WordPlacer, which was encouraging, though it didn’t look very crisp.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s