Skip to content

Instantly share code, notes, and snippets.

View erhhung's full-sized avatar

Erhhung Yuan erhhung

  • Silicon Valley
  • 23:21 (UTC -07:00)
View GitHub Profile
@erhhung
erhhung / images2video.js
Created October 7, 2016 02:02
Node.js class to encode a sequence of image files into VP9 WEBM video using FFmpeg.
/*
* encode image sequence into WEBM video
*/
import {exec} from 'child-process-promise';
import format from 'string-template';
import fsAsync from 'file-async';
import shell from 'shelljs';
import path from 'path';
import os from 'os';
@erhhung
erhhung / depthmap-loader.js
Created September 15, 2016 20:17
Load 16-bit PNG depth map using PngToy
class DepthmapLoader {
/**
* load 16-bit PNG depthmap from URL and return
* the normalized bitmap as a Canvas ImageData
*
* @param {string} url - URL of PNG image
* @return {Promise} -> {width,height,imageData}
*/
fetch(url) {
let pngtoy = new PngToy();