Current location: Brighton, UK

CanvasMaker v.0.2

Posted on Wednesday, November 28, 2007 @ 23:40 CET

After chatting with Chris on Monday over some Ardbeg, he showed me the PNGEncoder class that comes with Flex 3 (part of the mx.graphics.codec package). That reminded me that I'd seen that class before, as part of AS3 corelib - though in the com.adobe.images package. Sitting next to it was a JPGEncoder class so I wanted to compare it to the asfiles class I had been using in CanvasMaker. These were the times on 5 random passes on a 1024x768 image (time in ms):

  asfiles.encoding.JPEGEncoder com.adobe.images.JPGEncoder
Pass 1536412129
Pass 2540812230
Pass 3543112120
Pass 4542512062
Pass 5541012073
Average540712122

These were the times on 5 random passes on a 1600x1200 image (time in ms):

  asfiles.encoding.JPEGEncoder com.adobe.images.JPGEncoder
Pass 1600513607
Pass 2613013555
Pass 3612413638
Pass 4593113347
Pass 5613313635
Average606413556

As you can see the asfiles version kicks ass.

Next up I tried encoding to PNG (com.adobe.images.PNGEncoder) and got average passes of around 800 ms for a 1024x768 image and 1700 ms for a 1600x1200 image. Which completely leaves both JPEG encoders in the dust. So a quick edit to the PHP service and suddenly PNG became the default file type :)

I saw this comment by Natzke stating that the max size of BitmapData is 2880x2800 px, so I tried to encode with these dimensions and that took an average of about 7000 ms. Nuts.

The other additions include:

  • collapsible panels (since its getting quite long)
  • restricting the max image dimensions
  • an option for clearing the image when generating a new one
  • an option for disabling the animation
  • filetype selection (jpg or png)
  • now using TweenLite instead of Tweener since it seemed to do a better job in this speed test
  • the source can now be viewed by right-clicking

Anyways, you can check out version 0.2 of CanvasMaker here.

- paulo

Post a comment:

You must have Flash and JavaScript enabled to post a comment.