WebAssembly 使用 ClojureScript 进行图像处理

问题描述 投票:0回答:1

索取详情:

我们想在浏览器中进行一些图像处理和转换。 我们更喜欢 WebAssembly,因为它的运行时效率。 我们想要使用 ImageMagick,因为它可以读取 SVG、Ai 和我们想要使用的其他格式。 我们的项目是用 ClojureScript 编写的,用 Shadow-cljs 编译。

我们尝试过的一些库(这 > https://github.com/dlemstra/magick-wasm)这是我得到的错误:

Closure compilation failed with 1 errors
--- node_modules/@imagemagick/magick-wasm/dist/index.umd.js:21
Transpilation of 'This or super in instance member' is not yet implemented.

或者无法读取 SVG(这 > https://github.com/KnicKnic/WASM-ImageMagick,即使它是 ImageMagick 的包装)

或者无法编译(这 > https://silvia-odwyer.github.io/photon/ google-closure,它是 Shadow-cljs 生态系统的一部分,返回错误)这是我得到的错误:

Failed to inspect file
  /path-to-project/node_modules/@silvia-odwyer/photon/photon_rs_bg.wasm

it was required from
  /path-to-project/node_modules/@silvia-odwyer/photon/photon_rs.js

Errors encountered while trying to parse file
  /path-to-project/node_modules/@silvia-odwyer/photon/photon_rs_bg.wasm
  {:line 1, :column 0, :message "Character '' (U+0000) is not a valid identifier start char"}

photon_rs_bg.wasm 文件存在,并且权限正确。

您能否在这个问题上帮助我们或提出另一种更好的方法来使用 ClojureScript 进行图像处理?

webassembly clojurescript
1个回答
0
投票

shadow-cljs 目前不支持捆绑

.wasm
文件。

您可以通过 :js-provider :external 设置并使用 webpack 来进行 JS/WASM 捆绑。

© www.soinside.com 2019 - 2024. All rights reserved.