- Build result
WebAssembly build of ImageMagick and its libraries
montage, etc as an API.
Although it was implemented for magica it's totally independent of it and should be suitable for any use case needing.
See main() for simpler higher level implementation on top of it based on promises and defining a simple
- Generates shell scripts that:
- downloads latest versions of ImageMagick project and dependency libraries (mostly https://github.com/ImageMagick)
- the script builder accepts settings for:
- enable/disable features like quantum-depth, hdri
- build type: 'production', 'debug', 'incremental'
- enable/disable dependency library
- output folder, docker launch, script output, etc
- WIP settings to re-use existing sources and optimize wasm build time and/or compile only certain libraries
- WIP : command line tool to call the script generator
- report git commits/sources for each project downloaded.
TODO: the idea is to have a CLI that accepts parameters, builds scripts and optionally runs the build and tests. Right now what works instead is (
npx ts-node src/launch.ts)
Install the tool globally (or locally and call it with
npm install -g magick-wasm
Generates the default build type (production). in current directory and start it (docker needs to be up and running):
Generates a "debug" build type, reusing current PREFIX/src folders in given
It doesn't execute docker but prints instructions how to do it manually:
npx ts-node src/launch.ts --outputFolder $HOME/wasm/im --type debug --noClean --noRun
If everything is OK, (assuming default options),
emscripten_prefix/wasm/magick.js files should be generated.
TODO / STATUS / Roadmap
- minimal js api
- cli test
- test that control important build configuration (type=debug && type==production) (generates scripts from scratch, calls docker ) and run scripts/test-* scripts
(I need to ask)
- whats the use Magick.Native is necessary ? should I include that? what's the gain? consider browser and node.js
- Should I include font-config ? what's the gain?
wasm-builds/emscripten-scripts/base.shbase flags, debug or production build, etc
wasm-builds/emscripten-scripts/build.shlibraries build orchestrator
src/defaults.tshas defaults template context values (like depth, production/debug release, hdri, etc)
src/types.tstypes of template context and CLI/API options
run-docker command (Internal)
Docker needs to be installed and running.
cd build sh emscripten-scripts/run-docker.sh
If everything is OK that should generate magick WASM files at
Also, since latest versions of git projects for ImageMagick and libraries are used, the versions of each are dump at
Replace magica's and run its tests (Internal)
The following command clone's magica project, replace the wasm files with the new ones, and runs its tests to verify nothing it's broken.
Take into account that some tests could assume some magick capabilities or image format support that might not be so. Tests are not yet intelligent to detect current IM capabilities but they will be.
Project versions registry
- After a successfull build a file versions.txt file will be written with info about git repository urls and revisions used for each project
(OLD) Notes about package versions and sources
latest from official repository: https://github.com/ImageMagick/ImageMagick.git - cf00632d1
No modifications needed (we build all using --prefix and using PCK_CONFIG_PATH the configure script takes all dependencies from there.)
Latest from ImageMagick with little changes in mempng.c when free() C pointers (as Knicknic need to modify also to work with emscripten) https://github.com/cancerberosgx/png.git - 62b9724
TODO: discuss and PR to IM repo - I really don't understand (nto an expert) why this happen. Perhaps can be avoided using a emcc flag ? Also ask emscripten guys.
Probably could solve other libraries similar problems.
Latest from ImageMagick tiff repository with no modifications.
https://github.com/ImageMagick/tiff.git - 4965cb9
zlib: latest ImageMagick zlib repository with no modifications https://github.com/ImageMagick/zlib.git - 6a152c1
https://github.com/KnicKnic/libjpeg.git - fbaf3bf
Using wasm-imagemagick (knicknic) version. had trouble reading files with mageMagick/jpeg-turbo and with the original libjpeg repos (see below). TODO: ask knicknic for changes since git diff is not clear. Also we could search for an alternative / updated or look which changes are needed in those.
freetype: https://github.com/ImageMagick/freetype.git - 598ad7c
emscripten freetype port also work but I prefer this version since is "official" for IM and updated.
(fast fourier transformations)
downloading http://www.fftw.org/fftw-3.3.8.tar.gz - no modifications needed - no version control found. Has a couple non exhaustive tests
from official IM project without modifications: https://github.com/ImageMagick/webp.git. Although this library cmake has a js (WebAssembly target) using -DWEBP_BUILD_WEBP_JS=on it's not used and wasm is built as the rest of the libraries . Has read/write tests
Compiling fine from latest https://github.com/ImageMagick/open-jpeg.git. Has tests
turbo-jpeg (not included)
didn't work for most images since a problem in "markers" . There is some notes documenting this as limitation. But probably is an error related to why knicknic need to change the official library. In any case it compiles OK and writes OK but fails to read.
TODO: ask knicknic for help to patch this version or update his, since the diff in git is not clear.