mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 17:49:16 +02:00
Update license info on all webp-shim sources. Provide an example in the top-level README file for bitjs
This commit is contained in:
parent
557ef36bd0
commit
1bb77093ed
5 changed files with 45 additions and 5 deletions
16
README.md
16
README.md
|
@ -59,6 +59,22 @@ unzipper.update(anArrayBufferWithMoreBytes);
|
||||||
unzipper.update(anArrayBufferWithYetMoreBytes);
|
unzipper.update(anArrayBufferWithYetMoreBytes);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### bitjs.image
|
||||||
|
|
||||||
|
This namespace includes code for dealing with image formats. It includes a module for converting WebP images into alternative raster graphics formats (PNG/JPG).
|
||||||
|
|
||||||
|
```
|
||||||
|
import {convertWebPtoPNG, convertWebPtoJPG} from './bitjs/image/webp-shim/webp-shim.js';
|
||||||
|
|
||||||
|
// convertWebPtoPNG() takes in an ArrayBuffer containing the bytes of a WebP
|
||||||
|
// image and returns a Promise that resolves with an ArrayBuffer containing the
|
||||||
|
// bytes of an equivalent PNG image.
|
||||||
|
convertWebPtoPNG(webpBuffer).then(pngBuf => {
|
||||||
|
const pngUrl = URL.createObjectURL(new Blob([pngArr], {type: 'image/png'}));
|
||||||
|
someImgElement.setAttribute(src, pngUrl);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
* [bitjs.io tests](https://codedread.github.io/bitjs/tests/io-test.html)
|
* [bitjs.io tests](https://codedread.github.io/bitjs/tests/io-test.html)
|
||||||
|
|
|
@ -6,9 +6,6 @@ RUN apt-get update && apt-get install -y \
|
||||||
python \
|
python \
|
||||||
wget
|
wget
|
||||||
|
|
||||||
# Put more deps here ...
|
|
||||||
# RUN apt-get update && apt-get install -y \
|
|
||||||
|
|
||||||
RUN git clone https://github.com/webmproject/libwebp
|
RUN git clone https://github.com/webmproject/libwebp
|
||||||
|
|
||||||
RUN git clone https://github.com/emscripten-core/emsdk.git && \
|
RUN git clone https://github.com/emscripten-core/emsdk.git && \
|
||||||
|
@ -18,7 +15,7 @@ RUN git clone https://github.com/emscripten-core/emsdk.git && \
|
||||||
|
|
||||||
RUN git clone https://github.com/nothings/stb.git
|
RUN git clone https://github.com/nothings/stb.git
|
||||||
|
|
||||||
# Figure out how to invoke emsdk/emsdk_env.sh and have it affect PATH.
|
# TODO: Figure out how to invoke emsdk/emsdk_env.sh and have it affect PATH.
|
||||||
ENV PATH="$PATH:/emsdk:/emsdk/node/12.9.1_64bit/bin:/emsdk/upstream/emscripten"
|
ENV PATH="$PATH:/emsdk:/emsdk/node/12.9.1_64bit/bin:/emsdk/upstream/emscripten"
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/**
|
||||||
|
* webp.c
|
||||||
|
*
|
||||||
|
* Provides functionality for decoding a WebP imgae and converting it into
|
||||||
|
* alternative raster graphics formats (PNG/JPG).
|
||||||
|
*
|
||||||
|
* Licensed under the MIT License
|
||||||
|
*
|
||||||
|
* Copyright(c) 2020 Google Inc.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "emscripten.h"
|
#include "emscripten.h"
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/**
|
||||||
|
* harness.js
|
||||||
|
*
|
||||||
|
* Example of how to use the webp-shim functions.
|
||||||
|
*
|
||||||
|
* Licensed under the MIT License
|
||||||
|
*
|
||||||
|
* Copyright(c) 2020 Google Inc.
|
||||||
|
*/
|
||||||
import {convertWebPtoPNG, convertWebPtoJPG} from '../../../image/webp-shim/webp-shim.js';
|
import {convertWebPtoPNG, convertWebPtoJPG} from '../../../image/webp-shim/webp-shim.js';
|
||||||
|
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
/**
|
/**
|
||||||
*
|
* webp-shim.js
|
||||||
|
*
|
||||||
|
* Loads in the WASM module and exposes methods to convert a WebP image into
|
||||||
|
* alternative raster graphics formats (PNG/JPG).
|
||||||
|
*
|
||||||
|
* Licensed under the MIT License
|
||||||
|
*
|
||||||
|
* Copyright(c) 2020 Google Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const url = import.meta.url;
|
const url = import.meta.url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue