flyswatter/png-heightmap — pull request #1 by maxogden (2013-01-19 22:35:02+00:00)
Title: first crack

so the state of png libraries is kind of crappy. none of them work in both node and the browser easily using browserify.

i checked in a fork of png.js that works with browserify and opened and issue on the png.js site and also found a bug with browserify so if those bugs ever get fixed we can just use a normal dependency for png.js but for now it has to be vendored.

as for the API you can do this right now and it works:

```javascript
var heightmap = require('png-heightmap')

var chunkDistance = 2
var chunkSize = 32

heightmap('simple_sf.png', chunkDistance * 2 * chunkSize , function(err, pngGenerate) {
var game = createGame({
generate: pngGenerate
})
})
```

the api could probably be improved by making it take an options object or something as there are some hardcoded values that would be nice to make configurable

it also is kinda slow so maybe there is a faster way to do it?