libheif.js: the HEIC reader of the picture tools on postfjord.com/tools ======================================================================== What this folder is ------------------- The free picture tools on postfjord.com (HEIC to JPG, the image converter, crop, blur and the Instagram grid maker) open HEIC photos. Safari opens them by itself. In every other browser the page fetches libheif.js from this folder and runs it in a worker, on the visitor's own device. libheif.js holds two free software libraries, compiled to plain JavaScript: libheif 1.23.5 Copyright (c) 2017-2020 Struktur AG. Copyright (c) 2017-2026 Dirk Farin. https://github.com/strukturag/libheif (tag v1.23.5, commit 413e2a87e6a70b3eccc3a3adc5801179dd2d9e00) libde265 1.0.15 Copyright (c) 2013-2014 Struktur AG. Copyright (c) 2013-2023 Dirk Farin. https://github.com/strukturag/libde265 (tag v1.0.15) Both are licensed under the GNU Lesser General Public License, version 3 or later. Our use of them is covered by that license. You may copy them, change them and share them under the same license. They come with no warranty. The full license texts are in COPYING.txt (the GNU LGPL version 3, then the GNU GPL version 3 it builds on, then the MIT license of libheif's sample programs, which are not part of this build) and COPYING-libde265.txt (the same three texts, as libde265 ships them). The file also contains parts of the tools it was compiled with: the Emscripten 3.1.61 runtime (MIT license and University of Illinois/NCSA license, LICENSE-emscripten.txt) and the musl C library (MIT license, COPYRIGHT-musl.txt). Not modified by Postfjord ------------------------- libheif.js is the file the project catdad-experiments/libheif-emscripten published for its tag v1.23.5, byte for byte. Postfjord (Yogakollektivet Sverige AB) did not write it, change it, minify it or bundle it. Postfjord's own code is in other files: /tools/heic-worker.js and the page scripts under /tools. They load libheif.js by its address when the page runs and call the functions it exports. From: https://github.com/catdad-experiments/libheif-emscripten/releases/download/v1.23.5/libheif.js Size: 3,369,222 bytes SHA-256: 804551ee35288509d5bde23c480e956f9d7b2a0dfc0b36a6a9a8a5b01234d276 Postfjord's build stops when the file it is about to publish has another checksum. Every file here --------------- libheif.js the compiled library (see above) COPYING.txt libheif's COPYING at v1.23.5 SHA-256 fa81ce652315b013359d6e8e4744335f31a50c7c192907176d3632f78a3b4596 COPYING-libde265.txt libde265's COPYING at v1.0.15 SHA-256 02cc1585a20677992e0ba578fa692635dc193735f2691dc81de924b51c4e8020 LICENSE-emscripten.txt https://github.com/emscripten-core/emscripten/blob/3.1.61/LICENSE SHA-256 620a78084fc7ca97c0b5dea9abf891f3ffcadfdbf305276f099c9c4e12fc1d86 COPYRIGHT-musl.txt https://github.com/emscripten-core/emscripten/blob/3.1.61/system/lib/libc/musl/COPYRIGHT SHA-256 f9bc4423732350eb0b3f7ed7e91d530298476f8fec0c6c427a1c04ade22655af BUILD.txt how libheif.js was built, step by step build-scripts/emscripten.yml.txt the build workflow of libheif-emscripten at v1.23.5 SHA-256 a11b09520bf0af55dd522cfe81d3b1cb556e19ca0e87b0fd923f637d8ed40fe7 build-scripts/dist-prep.sh.txt its packaging script SHA-256 73cc977340ecbdb25ea1f4c4f4883757da837df68a6f48e2d9cd3f2bf71cf6dd source/libheif-1.23.5.tar.gz the source of libheif 1.23.5, with its build scripts https://github.com/strukturag/libheif/releases/download/v1.23.5/libheif-1.23.5.tar.gz 2,276,803 bytes, SHA-256 fd9036064c4432f0550d15072ddf34956a248279ee9aeaff0fba3fa0f77d8f1a source/libde265-1.0.15.tar.gz the source of libde265 1.0.15 https://github.com/strukturag/libde265/releases/download/v1.0.15/libde265-1.0.15.tar.gz 846,016 bytes, SHA-256 00251986c29d34d3af7117ed05874950c875dd9292d016be29d3b3762666511d The two source files are the complete source code for libheif.js: BUILD.txt says how one becomes the other. Use your own version -------------------- The library is a separate file so that you can replace it. Build your own libheif.js from the source (BUILD.txt), with your changes, and load it in place of ours. For that you need something that answers the address of libheif.js with your file: the local overrides in your browser's developer tools, or a proxy on your own computer. Then add a HEIC photo on any of the picture tools. What your build has to offer for our worker to use it: - It is a classic script that sets a global function named libheif, which returns a module (Emscripten's MODULARIZE with EXPORT_NAME=libheif, and no asynchronous start). - The module has HEAPU8, HEAP32, HEAPU32, _malloc and _free, and these functions of libheif's C interface: heif_context_alloc, heif_context_read_from_memory_without_copy, heif_context_get_primary_image_handle, heif_context_free, heif_image_handle_get_width, heif_image_handle_get_height, heif_image_handle_has_alpha_channel, heif_image_handle_get_color_profile_type, heif_image_handle_get_raw_color_profile_size, heif_image_handle_get_raw_color_profile, heif_image_handle_get_nclx_color_profile, heif_nclx_color_profile_free, heif_image_handle_release, heif_decoding_options_alloc, heif_decoding_options_free, heif_decode_image, heif_image_get_plane_readonly, heif_image_get_width, heif_image_get_height, heif_image_release (each with a leading underscore). - Our worker turns on strict decoding by writing 1 to byte 21 of the options that heif_decoding_options_alloc returns. That is where strict_decoding sits in this build. If your build lays the options out differently, a file that is cut off may open with parts missing. You may study and take apart our page scripts as far as you need to make your changed library work with them. Our Terms of Service say so too (postfjord.com/terms, section 3). Questions: hello@postfjord.com. The page that names all of this for visitors: https://postfjord.com/licenses