GithubHelp home page GithubHelp logo

Comments (3)

burnpiro avatar burnpiro commented on September 25, 2024

Hi, the error is caused by reasembleJS and it's because it only supports .png files (I'm not sure if other formats with transparency are supported but neither .jpg nor .webm are one of them). You need transparency to create a diff, but I guess we could work with white or black backgrounds as well. I could try to rewrite that part of the code and replace transparency with a solid background. Let me look at that over the weekend.

from puppeteer-screenshot-tester.

wadeharrell avatar wadeharrell commented on September 25, 2024

saw that, figured you knew the guy working on node-resemble.js ;)

Unfortunately I don't see any npm package for webp as straight forward as pngjs, but webp does support alpha https://developers.google.com/speed/webp/gallery2 so in theory it should be able to do everything you can with PNG at a much smaller file size; JPG is out of luck in that regard though.

In the context of puppeteer-screenshot-tester you know that you have chrome, so perhaps could leverage some canvas APIs? i.e. https://stackoverflow.com/a/55896125
I could see the case for even converting webp & jpg to PNG before sending them to resemble, then converting the diff to the desired output on the way back.

p.s. thanks for the quick response!

from puppeteer-screenshot-tester.

burnpiro avatar burnpiro commented on September 25, 2024

Fixed in v1.5.0.

Additionally, there is a new option to change the default compression levels for images. This might help with reducing the size if you want.

from puppeteer-screenshot-tester.

Related Issues (11)

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.