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 1 | 5364 | 12129 |
| Pass 2 | 5408 | 12230 |
| Pass 3 | 5431 | 12120 |
| Pass 4 | 5425 | 12062 |
| Pass 5 | 5410 | 12073 |
| Average | 5407 | 12122 |
These were the times on 5 random passes on a 1600x1200 image (time in ms):
| asfiles.encoding.JPEGEncoder | com.adobe.images.JPGEncoder | |
| Pass 1 | 6005 | 13607 |
| Pass 2 | 6130 | 13555 |
| Pass 3 | 6124 | 13638 |
| Pass 4 | 5931 | 13347 |
| Pass 5 | 6133 | 13635 |
| Average | 6064 | 13556 |
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.