Using the BPG javascript decoder in a web worker

问题内容:


I’m sorry for the long post, but if you have the knowledge to help it would be very much appreciated.

I want to be able to further configure the JavaScript decoder files provided by Fabrice Bellard on his BPG image project.

I read the documentation provided, but from what I could see the JavaScript decoder only accepts images that are already on the dom and saves those images onto a canvas using the rendered pixel data.

I was hoping to be able to interact with the pixel data in a web worker. In a way something like this:

1)

The *.bpg file would be downloaded as binary data on the worker thread.

2)

The binary data would be passed in to the bpg decoder, the decoder would convert the binary data into the final image data that would normally be written to a canvas. However instead that image data would remain accessible in the worker to be manipulated more.

For performance reasons I didn’t want to make the jump of having to render the data on a canvas in the main ui, pull it back out and send it back to the worker.

I tried to edit the pre-compiled JavaScript code and find the xhr request that calls for the image in order to edit the code around that function.

I did find it, but being that the code had been minified before I found it difficult editing it enough to do what I described above.

Please let me know if anyone knows how to set this up or has any suggestions.

问题评论:

原文地址:

https://stackoverflow.com/questions/47756054/using-the-bpg-javascript-decoder-in-a-web-worker

添加评论