views:

82

answers:

1

I'm currently migrating my image uploader from Gears to Firefox 3.6/HTMLv5. I used a Gears Worker in conjunction with Gears Canvas to scale down the selected photos before upload. By doing this, I kept the browser window responsive and avoided the "Do you want to stop this script"-warnings.

However, this doesn't seem to be feasible in HTMLv5: Web Workers don't have access to the DOM and can only receive JSON-serialized data. Even if I managed to serialize the contents of the selected image files, I am not sure if I can use the Canvas object in my worker to perform the downscaling.

Doing the scaling without workers will likely cause browser freezes with multi-megapixel images. Any ideas how to solve this problem?

A: 

If you implement the scaling algorithm yourself you can do it since ImageData objects are supported within Workers. If you need more tricky image manipulation tricks the best course of action would be to propose extensions to Web Workers to gain functionality. (E.g. by subscribing to the WHATWG list and describing your issue there.)

Anne
Can you describe this more precisely? What I want is an approach similar to the one of Gears: if allows you to use "gears canvas" functions from the worker, because a Gears Canvas can't draw anything, its just offscreen image manipulation.
Franz
That's not possible currently. I see you already suggested it on list, cool!
Anne