Using Python Pillow in front-end Angular

Viewed 277

I'm trying to use the Python Pillow library's resize function from within a front-end Angular 8 project.

While I know there are alternatives like OpenCV and HTML5 canvas but based on feedback, these alternatives won't work, with my use case. That is because the AI model that my front-end will be interacting with uses Pillow to model and there are some fundamental differences in the way Pillow does resize as compared to OpenCV and Canvas.

Differences between library resize:

Since I have not been able to find a previously built JavaScript port for Pillow, I assume that I would need to do it on my own, I've explored several Python to JavaScript "Translators" like Brython and Transcrypt but I understand they don't work well with external libraries (which Pillow requires).

Hence I decided to try my luck here to see if there have been anyone who has been in a similar situation and has a solution to my dilemma before I attempt to spend the hours porting Pillow and their respective libraries over to the dark side.

Thanks in advance for any help!

1 Answers

PyScript is a newer solution which can compile libs to wasm for you, but it's extremely slow to start

Related