Multi-threaded / non-blocking way of encoding images to Texture2D

I have a image loader in my Unity project that loads a few dozen large PNG / JPG images into the game and then encodes them to Texture2D by simply requesting the WWW.textureNonReadable. The problem is that my main game thread freezes during that last step (several hundred milliseconds per large image). This is very annoying so I’m either looking for a way to (A) do Texture2D creation in a coroutine somehow or (B) create the Texture2D in a separate thread (which seems to be impossible since the Unity API isn’t thread-safe) (would it be possible to do the decoding/encoding without Unity API functions / libraries?) (alternatively, would it be possible to run a separate Unity instance that handles file loading / Texture2D encoding and transferring that data back to the main instance?).

Pointers, and preferably examples, will be very much appreciated. Been stuck on this problem for quite a while.

For JPEG images, you could download our Super Fast JPEG plugin from the Asset Store:

The JPEG plugin is based on libjpeg and libjpeg-turbo.

It’s faster than Unity’s EncodeToJPG() and can also run in background threads.