Code Monkey home page Code Monkey logo

Comments (8)

photopea avatar photopea commented on May 26, 2024

Hi, can you try to send an ArrayBuffer as a frame? That would be newData.data.buffer in your case.

from upng.js.

friksa avatar friksa commented on May 26, 2024

This buffer is 160x46
buffer.zip

from upng.js.

photopea avatar photopea commented on May 26, 2024

Did you try to give it an ArrayBuffer instead of ArrayBufferView?

from upng.js.

friksa avatar friksa commented on May 26, 2024

Not sure I understand the question. This is how I get the buffer.
var newData = context.getImageData(0, 0, w, h);

from upng.js.

photopea avatar photopea commented on May 26, 2024

Then, you need to call

var bin = UPNG.encode([newData.data.buffer], w, h, 0);

from upng.js.

friksa avatar friksa commented on May 26, 2024

You called it. After testing, it seems that was the issue. Curious that it worked pretty well most of the time for non 0 color values.

It might help others too by documenting how to take content from a canvas and encode it to PNG using this library.

Thanks again for a great library!!

from upng.js.

photopea avatar photopea commented on May 26, 2024

Ok thank you for the donation! btw. you are the first person to donate to UPNG.js :)

from upng.js.

friksa avatar friksa commented on May 26, 2024

That's a bummer since this is such a great library. At least you know donations work now :)

You're welcome.

from upng.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.