Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to manually decode the image in browser - error #6

Closed
emirotin opened this issue May 30, 2012 · 1 comment
Closed

Trying to manually decode the image in browser - error #6

emirotin opened this issue May 30, 2012 · 1 comment

Comments

@emirotin
Copy link

Hi

Doing something in this manner (CoffeeScript, can provide compiled version)

image_url = "/images/ninja.png"
PNG.load image_url, null, (png) ->
    png.decode (pixels) ->
        console.log pixels

Fails here:

data = imageData.data;
length = data.length; // Cannot read property 'length' of undefined 

in .copyToImageData.

@devongovett
Copy link
Member

Should be fixed now. Sorry I didn't get to this sooner. Also, the decode method is synchronous in the browser, so the correct usage of the method would look like this:

image_url = "/images/ninja.png"
PNG.load image_url, null, (png) ->
    pixels = png.decode()
    console.log pixels

Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants