faster automotivator compositing

May. 13th, 2008 | 03:26 pm

AutoMotivator has a special fancy high res version so you can, in theory, make a motivational poster big enough to print and hang on your wall.

This has worked out reasonably well, but one sore point is the performance of ImageMagick for big images.

AutoMotivator works by taking the original photo, creating two PNGs for the title and inspirational text, and compositing them together against a black background with convert. On big images (2000 pixels or more on a side), it gets very slow (5-20+ seconds) and sucks up a lot of memory.

I'm not sure why it's so slow, but I suspect it's loading all the input images into memory, creating a big output image in memory, filling in the output, and then writing the output to disk.

Since my compositing needs are pretty simple, I don't have to load all that image data: producing each row of the output image only requires reading one row from each the images that single output row intersects. (This thought was originally inspired by picturetile, which must be incredibly slow.)

With that idea in mind, over the weekend I wrote a small compositing program in C. It uses the row-at-a-time input and output functions from libpng and libjpeg. The basic algorithm is:

  • get the dimensions and placement of the input data sources
  • note which data sources appear on each row
  • create a jpeg output object, and one output row
  • for each row in the output:
    • for each input source on that row:
      • merge a row from the input into the output row
    • write the output row out to disk
  • finish the output jpeg

I'm really rusty at C (it's been over ten years since my last useful C program), but the end result is working well: my compositor is about ten times faster than ImageMagick at assembling big poster images. Sure, it also has a hundredth of the features, but it fortunately does exactly what I need. And the difference in user experience quality between producing a poster in two seconds and 20 seconds is huge.

Link | Leave a comment | Add to Memories | Tell a Friend

Baby seals R us

Mar. 7th, 2008 | 03:06 pm

When I added the caption link capability to roflbot, this is exactly how I hoped people would use it. (Results)

Link | Leave a comment | Add to Memories | Tell a Friend

Big in Iberia

Mar. 5th, 2008 | 09:03 am

Check out the Spanish love!

Link | Leave a comment | Add to Memories | Tell a Friend

AutoPublicity

Feb. 27th, 2008 | 09:21 am

The Thrillist bit on AutoMotivator ran today and has resulted in a nice bump in traffic. Yay!

Link | Leave a comment | Add to Memories | Tell a Friend

More scrolly Lisp web toys

Feb. 12th, 2008 | 08:11 pm

screedbot is the latest Lisp-powered wigflip web toy. It's for making animated typewriter text graphics.

The original plan was to use a hybrid of Skippy and Vecto, but it turned out that rendering all the glyphs all the time got way too slow. To improve performance, I switched to making and caching a Skippy frame for every glyph seen in the font. That's eliminated the bottleneck of Vecto's rasterization work, and it can generate a GIF animation with hundreds of frames in a fraction of a second. I'm pretty happy with how it worked out.

It's hard to say which parts I can factor out into standalone libraries, but I do at least hope to write up the docs for the original hybrid library, Skepto, and release it.

Link | Leave a comment {9} | Add to Memories | Tell a Friend

dnt waste my time and yours

Feb. 8th, 2008 | 12:22 pm

Two script clone is still going strong. Apparently the last bidders (one guy was going to do it for $50) were incompetent lowballers. I like this comment on the current $350 bid: Sorry, but I cannot do this cheaper. It needs much work on browser and server side too.

Link | Leave a comment | Add to Memories | Tell a Friend

for you asofterworld fans

Feb. 5th, 2008 | 11:27 am

Upside: Only 46KB! Downside: 4.13 seconds to draw, 500MB consed. But I have a few optimizations up my sleeve...

Tags: ,

Link | Leave a comment {1} | Add to Memories | Tell a Friend

All work etc

Feb. 1st, 2008 | 07:56 pm

From a work-in-progress that marries Vecto and Skippy. More of a shotgun wedding at the moment. Code looks something like:

(with-animation (:width 500 :height 100)
  (looping t)
  (with-frame (:height 75 :width 15 :x 15 :y 15)
     ;; a bunch of vecto stuff
     (delay 50))
  ;;  many more with-frames
  (save-file "jack.gif"))

Fun! And I was able to do it with poor old bloated obsolete blazing-fast DSL-enabling pure rocking Common Lisp! The language with hash tables and arrays! And with a less gross incf idiom!

Tags: , ,

Link | Leave a comment {4} | Add to Memories | Tell a Friend

wigflip: clones in demand

Jan. 18th, 2008 | 07:51 am

all function need to be same or more advance

Link | Leave a comment | Add to Memories | Tell a Friend

gip wip

Jan. 15th, 2008 | 04:28 pm

From a work in progress. Whee!

update is what I mean.

Tags:

Link | Leave a comment | Add to Memories | Tell a Friend

day-maker otd

Nov. 18th, 2007 | 10:21 am

"Can't take much credit for how realistic the motivational poster looks - awesome site here does all the work."

Link | Leave a comment | Add to Memories | Tell a Friend

day-maker otd

Nov. 9th, 2007 | 09:10 am

"Somebody cool already has it..."

Tags:

Link | Leave a comment {1} | Add to Memories | Tell a Friend

officially slow-burning

Oct. 29th, 2007 | 10:53 pm

I've made my own motivational poster generator. There are several already out there, but mine has much nicer output. Go check it out, save it to del.icio.us, enjoy!

Link | Leave a comment | Add to Memories | Tell a Friend

sponsored links

Oct. 17th, 2007 | 04:23 pm

I did a quick search for roflbot and was surprised by the only sponsored link: Read more... )

Link | Leave a comment | Add to Memories | Tell a Friend

MORE LISP TOYS

Sep. 26th, 2007 | 04:50 pm

I got a little sidetracked when creating Vecto and made easystreet, a new wigflip toy. I had been meaning to make something like this for a while, but Vecto made it almost trivial to draw everything.

Link | Leave a comment {5} | Add to Memories | Tell a Friend

New roflbot feature

Jul. 22nd, 2007 | 09:06 pm

When you add text in roflbot, you can now drag a little corner widget to resize it with the mouse. It's fun to watch.

Link | Leave a comment | Add to Memories | Tell a Friend

my favorite so far

Jun. 29th, 2007 | 10:33 am

A while ago someone made this:

Link | Leave a comment {1} | Add to Memories | Tell a Friend

Big in Australia!

Jun. 29th, 2007 | 07:52 am

roflbot got a plug on news.com.au. Usually people point to the other lolcat buildr, but not this time! Onya, news.com.au!

Link | Leave a comment | Add to Memories | Tell a Friend

new roflbot mode

Jun. 12th, 2007 | 10:03 pm

roflbot now has a super special LJ icon mode. It has a special image selector that will display all your userpics:

There's also a special save page that'll load the completed image back into LiveJournal in addition to the other save options.

Try it out:

LJ User:

Link | Leave a comment {5} | Add to Memories | Tell a Friend

trendatron

Jun. 12th, 2007 | 12:01 pm

Google graphs plus delicious rss plus some Lisp equals trendatron. Not really useful in its current form, but I got big plans...

example: signbot

example: icanhascheezburger

Tags:

Link | Leave a comment {4} | Add to Memories | Tell a Friend