简体   繁体   English

在前端使用 Python 枕头 Angular

[英]Using Python Pillow in front-end Angular

I'm trying to use the Python Pillow library's resize function from within a front-end Angular 8 project.我正在尝试从前端 Angular 8 项目中使用 Python Pillow 库调整 function 的大小。

While I know there are alternatives like OpenCV and HTML5 canvas but based on feedback, these alternatives won't work, with my use case.虽然我知道有 OpenCV 和 HTML5 canvas 之类的替代方案,但根据反馈,这些替代方案不适用于我的用例。 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. 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). 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'不能与外部库(Pillow 需要)很好地配合使用。

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.因此,我决定在这里试试运气,看看是否有人遇到过类似的情况,并且在我尝试花几个小时将 Pillow 及其各自的库移植到黑暗面之前,是否有解决我的困境的方法。

Thanks in advance for any help!提前感谢您的帮助!

PyScript is a newer solution which can compile libs to wasm for you, but it's extremely slow to start PyScript 是一种较新的解决方案,它可以为您将库编译为 wasm,但启动速度极慢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM